|
|
View previous topic :: View next topic |
Author |
Message |
8051topic
Joined: 05 Nov 2009 Posts: 7 Location: Viet Nam
|
[Help] LCD.c and flex_lcd.c |
Posted: Fri Apr 16, 2010 10:10 am |
|
|
Hi everybody!
I'm using PIC16F887 and LCD 16x2.
I've problem: use flex_lcd.c is OK, but use lcd.c of CCS library the LCD display not right (#).
My code here:
Code: | #include <16F887.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#include <lcd.c>
//#include "flex_lcd.c"
#define LCD_DATA4 PIN_D0
#define LCD_DATA5 PIN_D1
#define LCD_DATA6 PIN_D2
#define LCD_DATA7 PIN_D3
#define LCD_ENABLE_PIN PIN_A1
#define LCD_RS_PIN PIN_A3
#define LCD_RW_PIN PIN_A2
//==========================
void main()
{
lcd_init(); // Always call this first.
while(1)
{
lcd_gotoxy(1,1);
printf(lcd_putc,"Hello you");
lcd_gotoxy(1,2);
printf(lcd_putc,"PIC16F887");
}
} |
I use internal crystal.
I did not edit #define in LCD.c file and CCS version is 4.105.
Thanks for all! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Apr 16, 2010 11:02 am |
|
|
If a file looks for #define statements, you need to put them above
the #include statement for the file. Example:
Code: |
#include <16F887.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#define LCD_DATA4 PIN_D0
#define LCD_DATA5 PIN_D1
#define LCD_DATA6 PIN_D2
#define LCD_DATA7 PIN_D3
#define LCD_ENABLE_PIN PIN_A1
#define LCD_RS_PIN PIN_A3
#define LCD_RW_PIN PIN_A2
#include <lcd.c>
|
|
|
|
8051topic
Joined: 05 Nov 2009 Posts: 7 Location: Viet Nam
|
|
Posted: Sat Apr 17, 2010 6:07 am |
|
|
Thank you very much.
It's worked perfectly. |
|
|
|
|
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
|