|
|
View previous topic :: View next topic |
Author |
Message |
salgulsen
Joined: 16 Sep 2009 Posts: 21
|
Having problems with PIC18F4620 I/Os |
Posted: Thu Mar 10, 2011 2:27 pm |
|
|
Hello,
I'm trying this code to display a message.
I can use the same i/o's with 16F877a (the LCD shows the message) but can't use them with 18f4620 to drive a 4x20 lcd with flex lcd driver
I thought the ECCP pins or the Interrupt activated portb pins were the problem but it seems like they are not.
The code is :
Code: | #include <18f4620.h>
#Fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#device ADC=16
#use delay(clock=20000000)
#use rs232(baud=19200, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
#byte P1B = 0xFBD
#byte PORTD = 0xF83
#byte TRISD = 0xF95
#byte PORTB = 0xF81
#byte TRISB = 0xF93
#define cs PIN_C2
#define clk PIN_C3
#define sdo PIN_C5
#include <Flex_LCD420_2Proto.c>
#include <stdlib.h>
#include <math.h>
#include <Button.c>
void lcd_welcome()
{
lcd_gotoxy(1,1);
printf(lcd_putc," *****v0.7***** ");
Delay_ms(2000);
printf(lcd_putc,"\f");
}
void main()
{
port_b_pullups(TRUE);
setup_adc(ADC_CLOCK_DIV_64); //6.4 us de bir data oku =*250 = 1.6 ms
//setup_adc_ports(AN0_TO_AN1);
P1B = 0;
PORTD = 0;
PORTB = 0;
TRISD = 0;
TRISB = 0;
setup_psp(PSP_DISABLED);
setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_CLK_DIV_64);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_ccp1(CCP_OFF);
disable_interrupts(global);
lcd_init();
Store_Custom_Char();
lcd_welcome();
while (1){
lcd_welcome();
output_high(pin_A2);
delay_ms(500);
output_low(pin_A2);
delay_ms(500);
}
}
|
The LCD pins are :
Code: |
// Flex_LCD420.c
// These pins are for my Microchip PicDem2-Plus board,
// which I used to test this driver.
// An external 20x4 LCD is connected to these pins.
// Change these pins to match your own board's connections.
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7
#define LCD_RS PIN_B2
#define LCD_RW PIN_B4
#define LCD_E PIN_B5
|
Thanks for your help... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 10, 2011 3:40 pm |
|
|
What is your CCS compiler version ? |
|
|
salgulsen
Joined: 16 Sep 2009 Posts: 21
|
|
Posted: Thu Mar 10, 2011 5:02 pm |
|
|
my compiler version is 4.104 |
|
|
salgulsen
Joined: 16 Sep 2009 Posts: 21
|
|
Posted: Fri Mar 11, 2011 2:39 pm |
|
|
I'm still out of clue what can cause the problem... |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 11, 2011 3:09 pm |
|
|
Delete 90% of your code and try a very simple test program:
Code: |
#include <18F4620.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4M)
#include <Flex_LCD420.c>
//=========================================
void main()
{
lcd_init();
lcd_putc("Hello World");
while(1);
} |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|