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 routine lockup

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







LCD routine lockup
PostPosted: Sat Mar 15, 2003 2:28 pm     Reply with quote

Hi everyone,

My LCD routine checks the busy flag of the LCD and make sure the LCD is not busy before writing new data to it. Therefore, if there is something wrong with the LCD module, my system hangs because it keeps checking and waiting for the LCD to be ready. Is there a way around this? Thank you for your help!

Regards,
Thomas
___________________________
This message was ported from CCS's old forum
Original Post ID: 12724
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: LCD routine lockup
PostPosted: Sat Mar 15, 2003 10:48 pm     Reply with quote

:=Hi everyone,
:=
:=My LCD routine checks the busy flag of the LCD and make sure the LCD is not busy before writing new data to it. Therefore, if there is something wrong with the LCD module, my system hangs because it keeps checking and waiting for the LCD to be ready. Is there a way around this? Thank you for your help!
:=
-----------------------------------------------------------

Don't use the busy flag. Just use a software delay.
See page 2 of the following specification:
<a href="http://www.hantronix.com/down/char-comm.pdf" TARGET="_blank">http://www.hantronix.com/down/char-comm.pdf</a>
In the lower right corner of the chart on page 2,
it says: "Execution times are typical. If transfers
are timed by software and the busy flag is not used,
add 10\% to the above times".

For example, that chart shows that writing to the DD ram
(ie., writing a character to the LCD display memory)
takes 46 us. So they recommend waiting about 51 us
after doing that command. To be extra safe, you could
wait 75 us.

___________________________
This message was ported from CCS's old forum
Original Post ID: 12728
Tomi
Guest







Re: LCD routine lockup
PostPosted: Sun Mar 16, 2003 3:42 am     Reply with quote

<font face="Courier New" size=-1>I always use the busy flag, too. (Typically in outdoor applications, where the necessary delay -which has a strong temperature-dependency- is unpredictable).
I use a pull-down resistor (5-10k or something low enough to pull down the pin to logic 0) on bit7. In this case if the LCD panel is not attached to the PIC or there is a problem with the panel then the PIC find a "ready" state on that pin.
BTW, I use this:
#separate
void FreeDisplay()
{
char errcnt;

errcnt = 0; // timeout reg.; limits the "retries" to 256
do {
CLRWDT4(); // small delay
DISP_DIR = 0xF0;
ED_DIR = 0;
RS_DIR = 0;
RWDISP_DIR = 0;
RS = 0;
RWDISP = 1;
ED = 0;
CLRWDT4();
ED = 1;
CLRWDT4();
bytepuf = DISP;
ED = 0;
CLRWDT4();
CLRWDT4();
ED = 1;
CLRWDT4();
CLRWDT4();
ED = 0;
} while (bit_test(bytepuf,7) && (--errcnt));
ED = 0;
DISP_DIR = 0x00;
ED_DIR = 0;
RS_DIR = 0;
RWDISP_DIR = 0;
RS = 0;
RWDISP = 0;
}



:=Hi everyone,
:=
:=My LCD routine checks the busy flag of the LCD and make sure the LCD is not busy before writing new data to it. Therefore, if there is something wrong with the LCD module, my system hangs because it keeps checking and waiting for the LCD to be ready. Is there a way around this? Thank you for your help!
:=
:=Regards,
:=Thomas</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 12731
Thomas
Guest







Re: LCD routine lockup
PostPosted: Sun Mar 16, 2003 12:32 pm     Reply with quote

Thank you everyone for your reply. Here is my solution:

void lcd_send_byte( byte address, byte data )
{
int LCDTimer;

LCDTimer = 0;
lcd.rs = 0;
while (bit_test(lcd_read_byte(),7))
{
++LCDTimer;
if (LCDTimer == 0xff)
break;
}
lcd.rs = address;
delay_cycles(1);
lcd.rw = 0;
delay_cycles(1);
lcd.enable = 0;
lcd_send_nibble(data >> 4);
lcd_send_nibble(data & 0xf);
}
___________________________
This message was ported from CCS's old forum
Original Post ID: 12747
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