|
|
View previous topic :: View next topic |
Author |
Message |
mxkid
Joined: 08 Apr 2008 Posts: 16
|
LCD with PICDEM 2 PLUS Board problems |
Posted: Thu Apr 10, 2008 1:50 pm |
|
|
Hi there,
Can anyone help? I'm trying to get the LCD display working on my PICDEM 2 PLUS board but I'm having no luck. Here is my code:
Code: |
#include<16f877.h>
#use delay(clock=4000000)
#fuses xt,nowdt,noprotect,put
#include<lcd.c>
#define LCD_DB4 PIN_D0
#define LCD_DB5 PIN_D1
#define LCD_DB6 PIN_D2
#define LCD_DB7 PIN_D3
#define LCD_E PIN_A1
#define LCD_RS PIN_A3
#define LCD_RW PIN_A2
void main()
{
lcd_init();
while(1)
{
//lcd_gotoxy(a,2);
lcd_putc("Hello");
delay_ms(1000);
}
}
|
I have the correct pinouts etc.. and the file compiles ok. I'm quite new at this so any help would be great! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Apr 10, 2008 2:04 pm |
|
|
There are two different versions of the PicDem2-Plus board, and they
require different versions of the Flex LCD driver.
This page shows the old version of the board: http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072&part=DM163022
This page shows the new "Rohs update" version:
http://www.microchipdirect.com/ProductSearch.aspx?Keywords=DM163022
Which board do you have ?
The driver that you're using comes from this post in the Code Library.
It has a sample program below the driver. It also has a link to the
changes required if you have the "Rohs" version of the PicDem2-Plus.
http://www.ccsinfo.com/forum/viewtopic.php?t=24661
However, I'm not sure you're using the Flex driver, because you have
an #include statement that refers to "lcd.c". That's the name of the
CCS driver. It's different from the Flex driver, given in the link above.
Use the one in the link, and save it as "flex_lcd.c".
I suggest that you use the sample test program. Your code as posted
leaves out several essential things. You've left out the NOLVP, and
you've left out the \f in the printf statement, which clears the LCD screen
and puts the cursor in the home position. If you use the sample code in
the link above, it will fix most of your problems. |
|
|
mxkid
Joined: 08 Apr 2008 Posts: 16
|
|
Posted: Thu Apr 10, 2008 2:57 pm |
|
|
Thanks for the prompt reply, Works a treat!! |
|
|
|
|
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
|