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 CCS Technical Support

lcd_getc(x,y) don't work?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dendenden98



Joined: 28 Jun 2011
Posts: 5

View user's profile Send private message

lcd_getc(x,y) don't work?
PostPosted: Tue Jun 28, 2011 6:20 pm     Reply with quote

Hi,

When I use my LCD program with lcd_getc(x,y) functions in PROTEUS. My program is run very good. But when I work in real circuit all of the other LCD functions runs, but lcd_getc(x,y) didn't. For example;

char ch;
....

printf(lcd_putc,"\fHello");

ch=lcd_getc(2,1);

printf(lcd_putc,"\n%c",ch);

delay_ms(1500);

I see in LCD:

1. Line=Hello
2.Line=_ (I see bold rectangle in this cursor. Normally I should see 'e' character. I see 'e' character in PROTEUS, but I don't see 'e' character in the real circuit)
temtronic



Joined: 01 Jul 2010
Posts: 9243
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jun 28, 2011 8:27 pm     Reply with quote

Quick comments

Do you have the LCD properly wired up? Show us your schematic of your hardware NOT the Proteus 'schematic'.

What PIC, compiler version, LCD driver ?

What LCD module? Have you the correct timing sequences for that LCD?
dendenden98



Joined: 28 Jun 2011
Posts: 5

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 2:03 am     Reply with quote

I wired up LCD correct. Because, other LCD functions are runs good. Only lcd_getc(x,y) functions don't run. I use lcd.c driver in PIC C directory. I use PIC16F877 and I try 2x16 character LCD. My compiler version is 4.107. I don't know I have correct timing for LCD. But all LCD functions runs in LCD driver except lcd_getc(x,y).
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 7:31 am     Reply with quote

Seriously, _try it with a real chip_.

I have Proteus, hundreds of versions, right up to the latest 7.9 beta. Love it as a schematic design/PCB package, and it's analog simulation is also good, _but_ it's PIC emulation, and that of many digital peripherals, is not reliable, and not worth using in general. I'd suspect that Proteus, is simply not emulating the data read operation from the LCD, which is why it won't work for you.

flex_lcd, can be configured to be 'write only', not using the R/W line, in which case the read function won't work, but the standard LCD driver, _requires_ data returns from the chip, reading the 'busy' status line. So all your operation have to be working, it is just that you are not getting the character data back - hence the suspicion that the emulation does not do this correctly - few people ever use the read function (after all if you send data to the LCD, you know what should be there!.....), so it is probably just something that Proteus does not bother to emulate.

Best Wishes
dendenden98



Joined: 28 Jun 2011
Posts: 5

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 8:00 am     Reply with quote

Quote:

Seriously, _try it with a real chip_.

I have Proteus, hundreds of versions, right up to the latest 7.9 beta. Love it as a schematic design/PCB package, and it's analog simulation is also good, _but_ it's PIC emulation, and that of many digital peripherals, is not reliable, and not worth using in general. I'd suspect that Proteus, is simply not emulating the data read operation from the LCD, which is why it won't work for you.

flex_lcd, can be configured to be 'write only', not using the R/W line, in which case the read function won't work, but the standard LCD driver, _requires_ data returns from the chip, reading the 'busy' status line. So all your operation have to be working, it is just that you are not getting the character data back - hence the suspicion that the emulation does not do this correctly - few people ever use the read function (after all if you send data to the LCD, you know what should be there!.....), so it is probably just something that Proteus does not bother to emulate.

Best Wishes


So What Can I do to solve this my problem?
Ttelmah



Joined: 11 Mar 2010
Posts: 19540

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 8:10 am     Reply with quote

Use a real chip...
dendenden98



Joined: 28 Jun 2011
Posts: 5

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 8:35 am     Reply with quote

I already use real LCD. I can't understand exactly what you mean that you say use a real chip.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 12:22 pm     Reply with quote

I made a test program from your code, and I used the CCS lcd.c driver
that comes with vs. 4.107, and I ran it on a PicDem2-Plus board (red vs.)
and it works. Here's the output:
Quote:

Hello
e


So I suspect a hardware problem or LCD driver configuration problem.
Your LCD may not support reading.

What's the manufacturer and part number of your LCD ?
Did you build your own board or did you buy it ? If you bought it,
what's the manufacturer and part number of the board ?
Post a list of the connections between the LCD and the PIC.
Post how you configured the LCD driver to use those connections.

Here's the test program:
Code:

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

// This are the LCD pins for PicDem2-Plus (red board):
#define LCD_ENABLE_PIN  PIN_A1
#define LCD_RS_PIN      PIN_A3 
#define LCD_RW_PIN      PIN_A2
#define LCD_DATA4       PIN_D0   
#define LCD_DATA5       PIN_D1   
#define LCD_DATA6       PIN_D2
#define LCD_DATA7       PIN_D3 

#include <lcd.c>

//======================================
void main(void)
{
char ch;

lcd_init();

printf(lcd_putc,"\fHello");

ch=lcd_getc(2,1);

printf(lcd_putc,"\n%c",ch);

delay_ms(1500);

while(1);
}
 
dendenden98



Joined: 28 Jun 2011
Posts: 5

View user's profile Send private message

PostPosted: Wed Jun 29, 2011 9:53 pm     Reply with quote

Thanks PCM Programmer. I re-build my LCD connection and it's run. But I don't understand in my old circuit, all LCD function runs except lcd_getc() function. But now I re-build my LCD connection and lcd_getc() function is run in addition to other LCD functions. interesting.

Thanks to all who respond.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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