CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Problem with LCM-SO1602DTR/M LCD on Picdem 2 Plus Demo Board
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

Problem with LCM-SO1602DTR/M LCD on Picdem 2 Plus Demo Board
PostPosted: Sat Aug 04, 2007 7:37 am     Reply with quote

Hello

I have a problem with the LCD display on the Picdem 2 Plus Demo Board 2006.
I can't display anything using the lcd.c driver that I tried to update or other programs I found at here as lcdd.c.

The pin connection is as follows:
D0 D4
D1 D5
D2 D6
D3 D7
D4 rs
D5 rw
D6 enable
D7 power

If someone has a working driver or has any idea to help me it will be very welcome.
Thank you

Best reards,

Dominik
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 11:54 am     Reply with quote

There are two threads on this.

In this thread, we discover that the LCD's "busy" bit doesn't work,
on at least on some of the "Rohs update" PicDem2-Plus boards.
http://www.ccsinfo.com/forum/viewtopic.php?t=29768

In this thread, the person says it was only necessary to turn on
power to the LCD, and then it worked.
http://www.ccsinfo.com/forum/viewtopic.php?t=29521

I still don't have one of the new "Rohs update" boards.
Here is what I believe you should do:

1. Use the "Flex" lcd driver at this link:
http://www.ccsinfo.com/forum/viewtopic.php?t=24661

2. Change the pin list at the start of the driver, so it uses these pins:
Code:

#define LCD_DB4   PIN_D0
#define LCD_DB5   PIN_D1
#define LCD_DB6   PIN_D2
#define LCD_DB7   PIN_D3

#define LCD_E     PIN_D6
#define LCD_RS    PIN_D4
#define LCD_RW    PIN_D5


3. Comment out the line which tells the driver to use the R/W pin
on the LCD. This line is just below the pin list in the driver.
Code:
// #define USE_LCD_RW   1     


4. Try this test program:
Code:

#include <16F877.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)

#define LCD_POWER  PIN_D7

#include "Flex_LCD.c"

//============================
void main()
{
output_high(LCD_POWER);  // Turn on power to LCD
output_low(LCD_RW);      // Set R/W pin on LCD to a low level
lcd_init();              // Initialize the LCD

lcd_putc("Hello World");


while(1);
}


There is no guarantee that this works, because I don't have the new
"Rohs update" version of board.
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 1:45 pm     Reply with quote

Thank you Mr PCM Programmer

I've tried your test program including the flex_LCD with the update you said and it's working !

The only problem remaining is that there's a strange character displaying on the LCD just after the characters that I want to display.

Kind regards,

Dominik
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 2:13 pm     Reply with quote

Post a test program that shows the problem. Make it be similar
to the one that I posted, but have it show your problem. (Keep it small).
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 2:27 pm     Reply with quote

The program I used is the one you sent to me :

#include <16F877.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)

#define LCD_POWER PIN_D7

#include "Flex_LCD.c"

int x = 1;


//============================
void main()
{
output_high(LCD_POWER); // Turn on power to LCD
output_low(LCD_RW); // Set R/W pin on LCD to a low level
lcd_init(); // Initialize the LCD

lcd_putc("Hello");


while(1);
}

And what is dsiplayed on the LCD is ---> Hello†
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 2:41 pm     Reply with quote

Does your PIC have a 4 MHz crystal ?
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 2:46 pm     Reply with quote

The Quartz is the one on the Picdem Board ---> JWT 4.00/5V MHZ and the PIC I'm using is a 16F877A
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 3:13 pm     Reply with quote

Quote:
The Quartz is the one on the Picdem Board ---> JWT 4.00/5V MHz
and the PIC I'm using is a 16F877A.


You need to change the include file so it's for the 16F877A instead of
the 16F877. Example:
Code:
#include <16F877A.H>
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 3:28 pm     Reply with quote

I've changed the line :

Quote:
#include <16F877A.h>


But I still have the character after.

The PIC I'm using is a PIC16F877A-I/P if it can help
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 3:43 pm     Reply with quote

Try adding an additional delay after applying power. There's already
a delay statement in the Flex driver's init_lcd() routine, but maybe it's
not enough. Add the line shown in bold below, in exactly that position:
Quote:

output_high(LCD_POWER); // Turn on power to LCD
delay_ms(100);
output_low(LCD_RW); // Set R/W pin on LCD to a low level
lcd_init(); // Initialize the LCD

If this doesn't work, I'll look at it some more tomorrow. At that time
I will be able to look at the LCD data sheet and sample drivers from
Microchip and the LCD manufacturer, that I have on my PC at work.
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 4:08 pm     Reply with quote

I tried by adding :

Quote:
delay_ms(100);
at the place you said but the character is still displaying.

So let's see that tomorrow but anyway thank you so much for your help !

Best regards,

Dominik
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 04, 2007 4:41 pm     Reply with quote

Also, post your compiler version. It's a 4-digit number in this format x.xxx
and you can find it at the top of the .LST file, which is in your project
directory. Don't post any numbers that come after the version number.
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sun Aug 05, 2007 1:14 am     Reply with quote

The version I found in the LST file is :

CCS PCM C Compiler, Version 4.013
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Aug 05, 2007 2:54 pm     Reply with quote

That's an early version. It's possible that it's causing a problem, but it
may not be. I briefly compared the .LST files between vs. 3.249 and
4.014 (don't have 4.013) and I didn't see any differences in the areas
where I looked. I don't have time to look at all of it.

I'm trying to think of what could cause an extra character at the end
of a line.

1. It's possible that the LCD control lines are being left in some
indeterminate state, and somehow this causes a bad extra character.

2. Perhaps the LCD power pin is being glitched at the end of the
string, for some unknown reason, and this causes a bad character.

3. Perhaps the compiler isn't properly detecting the "end of string"
in the "Hello" string, and is sending a garbage character at the end.

4. The "busy" delay in the lcd_send_byte() routine may be too low.

5. The initialization bytes in the Flex driver not be exactly correct
for this LCD.

6. It's possible that you didn't do all the changes that I said in an earlier
post, such as commenting out the "#define USE_LCD_RW 1" line
in the Flex driver.

7. It may be that you're running a different test program than the one
that you posted. I may not be looking at your real program, and
therefore, I can't see the actual problem.


Let's try an experiment, assuming that it's item #4. Edit the Flex_lcd.c
driver, in lcd_send_byte() routine. See the line shown in bold below ?
Increase it to a much larger value, such as 500 us. Re-compile, and
re-program, and see if it helps.

Quote:

void lcd_send_byte(int8 address, int8 n)
{
output_low(LCD_RS);

#ifdef USE_RW_PIN
while(bit_test(lcd_read_byte(),7)) ;
#else
delay_us(60); // Try increasing this to 500.
#endif


If that doesn't work, try another experiment. Instead of sending a
string, send individual characters.

Instead of doing lcd_put("Hello"), break it up into individual putc()
statements, with delays in between, and with a large delay at the end.
See if you still get that 't' character. If you do, does it appear after
the 5 second delay at the end ?
Code:

lcd_putc('H');
delay_ms(100);
lcd_putc('e');
delay_ms(100);
lcd_putc('l');
delay_ms(100);
lcd_putc('l');
delay_ms(100);
lcd_putc('o');
delay_ms(5000);


Can I ask where you got the Rohs version of the PicDem2-Plus ?
You don't have to tell me. But if I knew where I could order one
and be guaranteed that I would get it (and not get the old version),
then I'd order one. Then I could fix this problem. 'Cause right now,
it's just shooting in the dark. Doing this by remote control just doesn't
really work.
Dominik



Joined: 04 Aug 2007
Posts: 18

View user's profile Send private message

PostPosted: Sun Aug 05, 2007 3:49 pm     Reply with quote

I've updated the compiler's version to the :

CCS PCM C Compiler, Version 4.038 and now I don't have no more that character problem with that program.
But I have one when I want to display a value as below:

Code:

#include <16F877A.h>
#fuses XT,NOWDT,NOPROTECT,BROWNOUT,PUT,NOLVP
#use delay(clock=4000000)

#define LCD_POWER  PIN_D7

#include "Flex_LCD.c"

//============================
void main()
{

char x;
x="Hello";

output_high(LCD_POWER);  // Turn on power to LCD
delay_ms(100);
output_low(LCD_RW);      // Set R/W pin on LCD to a low level
lcd_init();              // Initialize the LCD

lcd_putc(x);

while(1);
}


I don't have the value displaying on the LCD but only the character that I have before when I was using the 4.013 version.

This might becoming of that lastest Demo Board that I have bought at Microchip Direct Part Number DV164006.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
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