View previous topic :: View next topic |
Author |
Message |
doggitz
Joined: 04 Sep 2011 Posts: 9
|
Having trouble with flex lcd |
Posted: Wed Sep 14, 2011 6:28 pm |
|
|
I need help too !!
I am having the exact same trouble.
Using 18F4620
Have modified flex_lcd for following pins
E D5
RS D4
Data D0 - D3
Have tried both lcd and flex_lcd and only get black squares
I know my physical layout is OK as the lcd and chip works perfectly with basic compiler
Here is my program
Code: |
#include <test001.h>
#define ENABLE_PIN D5
#define RS_PIN D4
#define Data4 D0
#define Data5 D1
#define Data6 D2
#define Data7 D3
#include <flex_lcd.c>
void main()
{
lcd_init();
while(1)
{
lcd_putc("Hello World");
delay_ms(500);
}
}
|
PCWH compiler purchased w/i last few weeks. I have been at this for 10 days and can't make the &%*^ work. Able flash an led w/o problem. Using pickit 2. Any thoughts appreciated. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Thu Sep 15, 2011 9:38 am |
|
|
Unless you've modified the original flex_lcd.c driver and renamed the pins definitions....to YOUR assignments..
#define ENABLE_PIN D5
#define RS_PIN D4
#define Data4 D0
#define Data5 D1
#define Data6 D2
#define Data7 D3
...
then the driver will use , in the following case,,
PIN_B4 for the LCD_DB4 defines.
// my modified flex_lcd.c
//called test_flex_lcd.c
#define LCD_DB4 PIN_B4
#define LCD_DB5 PIN_B5
#define LCD_DB6 PIN_A1
#define LCD_DB7 PIN_A2
#define LCD_E PIN_B1
#define LCD_RS PIN_B3
#define LCD_RW PIN_B2 //not used !
I'd suggest you copy the original flex_lcd.c to 'my_flex_lcd.c' and then redefine the LCD_... defines to match your pin layout.This way you still have the original to look at if(when) your program fails.It also makes it easy to have several LCD pin layouts for different projects.
hth jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Thu Sep 15, 2011 9:50 am |
|
|
Also, obvious thing, pin numbers are in the form 'PIN_D5', not 'D5'......
Best Wishes |
|
|
|