Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/23/06 21:44
Read: times


 
#118975 - Second Try
Responding to: ???'s previous message
Well I had a really nice reply typed up but for some reason my browser died... :-(

First, the original March 1987 Hitachi LCD Driver LSI Data Book in front of me states that if your power supply doesn't rise between 0.1ns and 10ns then the internal reset fails. When that happens you have to use:

- wait > 15ms
- Function Set
- wait > 4.1ms
- Function Set
- wait > 100us
- Function Set
- Now you can read BF
- Issue commands (starting with, you guessed it, Function Set)

I think Hitachi themselves as well as the millions of clones have since improved greatly on the original. I have made boat-fulls of products with LCDs where the CPU just polls BF at the start. No particular power supply. Many wall warts even. No field complaints. Ever. YMMV. Unless you are buying LCDs at surplus, not a problem.

Anyway, point #2 about the wait loop, I stand corrected. I did not see the SETB EN. Here is my technique for an 8-bit interface which can read from the LCD. I have to say the memory mapped Motorola version is much nicer, you just read from an external memory location. NOTE YOU MAY WANT TO ADD A TIME OUT IN CASE THE LCD IS ABSENT. I have a Ceibo Ice that dies if you open the case (which you need to do often) and when the case is open, the LCD cable is too short and pops out.


/*
.----------------------------------------------------------------
| void LcdWait(void);
|
| Waits in a loop while the LCD busy flag is set (BF=1).  
|
| Requires: Nothing
| Returns:  Nothing (leaves RS=0, RW*=1 and LCD_PORT = FF)
`----------------------------------------------------------------*/
void LcdWait(void)
{
U8 tmp;

LCD_PORT = 0xFF;                       // Set port for inputs.
LCD_RS = 0;                            // RS = 0 for LCDCR.
LCD_RW = 1;                            // Set R/W* = 1.

do{
   LCD_E = 1;                          // E high.
   tmp = LCD_PORT;                     // Read the data.
   LCD_E = 0;                          // E low again.
   }
while(tmp & 0x80);                     // If BF = 0, done.
}


I'm sure those using assembler are horridfied. You also need to make sure you meet the setup and hold times for the device you are accessing. On a fast micro you can out-pace the LCD. I have shown the above for concept only.

GB


List of 8 messages in thread
TopicAuthorDate
LCD 2 line example code            01/01/70 00:00      
   post such things to the code library            01/01/70 00:00      
   Assumes you can read from the LCD            01/01/70 00:00      
      Apparently not...            01/01/70 00:00      
         Second Try            01/01/70 00:00      
            not at all            01/01/70 00:00      
               Shouldn't you be home by now?            01/01/70 00:00      
   Also, in the interests of saving CPU            01/01/70 00:00      

Back to Subject List