> >On March 15, 2003 12:33 PM, Thomas N wrote: > > > > 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 At 12:51 PM 3/15/03 -0800, Daniel Imfeld wrote: >The simplest way to do this would be to add a counter variable that you >increment once every time you check the LCD module. If the counter >exceeds a certain value, then you assume something wrong with the LCD >module and take appropriate action. Just make sure that the value is >high enough that you allow plenty of time for the LCD to finish if it is >working correctly. You might have to make it 16 bits, depending on >clock speed and how long the LCD normally takes to write. Also keep in mind Andy Warren's suggestion: poll the busy flag BEFORE you do your write rather than after. Many people do their LCD write, then wait until the busy flag is clear before continuing with their program. Andy suggests: make sure the flag is clear, then do the write, then get back to your routine (without waiting). Assuming that much LCD interaction is with the user in real time, this can give your display a much faster apparent response.. Old method: wait for user input, deal with user input, write display, wait for display to finish, deal with user input, etc. Andy's way: wait for user input, deal with user input, make sure display is ready to write (wait if you have to), write display, deal with user input, etc. In other words, you are busy doing your thing WHILE the display is busy doing its thing. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 19 years of Engineering Innovation (1984 - 2003) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.