|
|
View previous topic :: View next topic |
Author |
Message |
Thomas Guest
|
LCD routine lockup |
Posted: Sat Mar 15, 2003 2:28 pm |
|
|
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
|
Re: LCD routine lockup |
Posted: Sat Mar 15, 2003 10:48 pm |
|
|
:=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 |
Posted: Sun Mar 16, 2003 3:42 am |
|
|
<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 |
Posted: Sun Mar 16, 2003 12:32 pm |
|
|
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 |
|
|
|
|
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
|