Hello everyone, With your help, I successfully modified the code so it has both polling function and time out timer. Yes, I check the busy flag BEFORE I send the data to the LCD to save time. Here is the code (under CCS PIC C). Thanks again! Thomas //--------------------------------------------------------------------- // send data to LCD //--------------------------------------------------------------------- void lcd_send_byte( byte address, byte data ) { long LCDTimer; LCDTimer = 0; lcd.rs = 0; while (bit_test(lcd_read_byte(),7)) { ++LCDTimer; if (LCDTimer == 0xffff) 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); } >From: Jai Dhar >Reply-To: pic microcontroller discussion list >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC]: LCD routine Lockup >Date: Sat, 15 Mar 2003 21:13:17 -0500 > >If you need code, I have some written for an f877 and f628, although I >don't >poll the busy flag. I was just doing a one off with a particular LCD, so I >didn't worry about future compatibility. Let me know if you want it. > >Quoting Thomas N : > > > Thank you everyone for your help. You all are very, very helpful! I >will > > use the polling method to check for the busy flag and also implement the > > time out period just in case the LCD doesn't response. I am still >testing > > the code right now. It doesn't work yet... > > > > Regards, > > Thomas. > > > > > > >From: samo benedihih > > >Reply-To: pic microcontroller discussion list > > >To: PICLIST@MITVMA.MIT.EDU > > >Subject: Re: [PIC]: LCD routine Lockup > > >Date: Sat, 15 Mar 2003 23:35:59 +0100 > > > > > >Hi! > > > > > >Check here: http://www.epemag.com/library.html. for tutorial on LCD's. >It > > >has all I needed to know about LCD's on just a few pages, including > > >tipical > > >times for certain operations on LCD to complete. It also says that >LCD's > > >sometimes lock up when you poll busy flag. Regards, Samo > > > > > > > > > > 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 > > > > > > > > > >-- > > >http://www.piclist.com hint: The PICList is archived three different > > >ways. See http://www.piclist.com/#archives for details. > > > > > > _________________________________________________________________ > > The new MSN 8: advanced junk mail protection and 2 months FREE* > > http://join.msn.com/?page=features/junkmail > > > > -- > > http://www.piclist.com hint: The PICList is archived three different > > ways. See http://www.piclist.com/#archives for details. > > > > > > >---------------------------------------- >This mail sent through www.mywaterloo.ca > >-- >http://www.piclist.com hint: The PICList is archived three different >ways. See http://www.piclist.com/#archives for details. _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.