View previous topic :: View next topic |
Author |
Message |
falonsos
Joined: 01 May 2010 Posts: 5
|
16F877A LCD at 20 MHz |
Posted: Sat May 01, 2010 6:09 pm |
|
|
Hello.
I have been working very hard trying to make a 16x2 LCD work. But I just couldn't make it...
I hope somebody can help me with this. The code I'm using is:
Code: |
#include <16F877A.h>
#use delay(clock=20000000)
#FUSES NOWDT //No Watch Dog Timer
#FUSES RC //Resistor/Capacitor Osc with CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES HS
#include <lcd.c>
void main()
{
lcd_init();
printf(lcd_putc,"/fhello world");//lcd_putc("hello");
while(TRUE)
{
}
}
|
Thanks a lot!! |
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Sat May 01, 2010 6:55 pm |
|
|
Quote: |
#FUSES RC //Resistor/Capacitor Osc with CLKOUT
#FUSES HS
|
You have a redundant pre-processor directive, the compiler always validate the last option:
HS in this case, wich assume that you have a crystal in the oscillator module.
Regards,
Humberto |
|
|
falonsos
Joined: 01 May 2010 Posts: 5
|
|
Posted: Sat May 01, 2010 7:03 pm |
|
|
Thanks! I will delete that line right away!
But, I'm using a crystal in the oscillator module of 20 MHz. So I don't think that's the problem. |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1614 Location: Central Illinois, USA
|
|
Posted: Sat May 01, 2010 8:55 pm |
|
|
Did you write the driver for the LCD yourself or are you using something included with CCS PIC-C?
Most of the time, the common mistakes are:
PIN Assignments
Timing Issues
PORT settings (TRIS)
I see you're include LCD.C, but no where have you defined where the LCD is hooked up (what port, pins, etc)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
|