|
|
View previous topic :: View next topic |
Author |
Message |
dredwinphd1
Joined: 03 Mar 2014 Posts: 7 Location: Gun Barrel City, Texas
|
flex_lcd.c won't compile properly |
Posted: Mon Mar 17, 2014 7:50 pm |
|
|
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
I found your flex_lcd.c for driving 2 line HD44780 compatible character displays and tried to compile it using the PCW version 5 and it won't compile properly. I get the following error messages.
*** Error 20 "TEST_VFD.c" Line 4(10,20): Filename must start with " or <
*** Error 12 "TEST_VFD.c" Line 9(12,13): Undefined identifier -- lcd_init
*** Error 12 "TEST_VFD.c" Line 10(16,17): Undefined identifier -- lcd_putc
*** Error 12 "TEST_VFD.c" Line 11(16,17): Undefined identifier -- lcd_putc
4 Errors, 0 Warnings.
Build Failed.
I am also using a VFD drop in replacement but without the software working I cannot test it.
Please e-mail me if you can help me (us) out at [email protected] _________________ Ed Edmondson
206 Woodwind Street
Gun Barrel City, Texas 75156-3934 |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Tue Mar 18, 2014 3:15 am |
|
|
You do understand it is the _test program_ you compile, _not_ the driver?.
Look in the driver post, the test program is just a handful of lines in a separate box underneath.
The flex driver needs to be cut and pasted into a file called "flex_lcd.c", in the same directory as the test program. You modify the test program to include the correct defines for your processor. Similarly you modify flex LCD itself, to use the pins you want.
Now the errors you are getting say you have mistyped the line to load the driver (the filename needs to be in either "" or <>). This is what error 20 is saying you do not have. Then since the driver is not loaded, 'of course' lcd_init, putc etc., are undefined. |
|
|
dredwinphd1
Joined: 03 Mar 2014 Posts: 7 Location: Gun Barrel City, Texas
|
Thanks! It works Great. |
Posted: Wed Mar 19, 2014 4:15 pm |
|
|
Ttelmah, thanks for your assistance and comments. As you probably have noticed I am a semi-educated newbie (is this the correct term).
I was informed that I missed adding the " " which enclosed the file name "flex_lcd.c".
I have already been able to test a Noritake, Futaba LCD equivalent modules and a Sharp 20 x 2 LCD display without any trouble. I have an OLED display and when it is run the "Hello World" displays "llo World". The manufacturer indicates that the following might be the reason:
The most notable differences are in the command execution time, and the “Clear Display” command.
The execution times are listed in the datasheet page 7: http://www.newhavendisplay.com/specs/NHD-0220DZW-AG5.pdf
Clear Display does not change the DDRAM address to the home location (0x00) as most LCDs do.
My guess is: before writing “Hello World”, are you using either “Clear”, “Home”, or “Set Address” commands?
If so, the display is probably still executing those commands and losing the first two characters during that time.
Can you try adding some time delays after the commands and see if the characters show up?
I have added another post asking help to allow me to use 20 x 4 LCD modules. _________________ Ed Edmondson
206 Woodwind Street
Gun Barrel City, Texas 75156-3934 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Mar 20, 2014 12:26 am |
|
|
Right, but in the lcd_init() routine it delays for 5ms after each command,
and the requirement is only 600us for most commands, and 2ms for the
clear display command. When the LCD is running the driver checks the
busy bit. I don't think those delays are the problem.
The data sheet you linked to, shows a power-up delay of only 1 ms.
I doubt this. I looked on the CrystalFontz website at one of their
character OLED displays, and in the WS0010 controller data sheet
the 4-bit init flowchart shows a power-up delay of 500 ms.
Why don't you add a delay_ms(500); statement at the start of main(),
before you call the lcd_init() routine. See if that helps. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Thu Mar 20, 2014 3:37 am |
|
|
The commonest problem is the delay at boot. An extra problem here is that the LCD, and the PIC, don't have the same criteria for when they actually start!.
Many 5v LCD's, don't actually start, till the supply gets up to perhaps 4.2v. Most PIC's start when the voltage is only perhaps 3v. Now if you have an LCD that specifies a 'wake up' delay of 500mSec, this is from when 'it' starts, not the PIC. If the rise time of the supply is long (big capacitors....), then there may easily be another 50mSec, between when the PIC starts, and when the LCD starts.
Hence most people here who have used LCD's a lot, will suggest having perhaps a 500 or 600mSec delay, at the start of the PIC code, before calling the 'lcd_init'. Go at least a few mSec _longer_ than the specified delay for the LCD. It is much more likely to work reliably.
Best Wishes |
|
|
|
|
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
|