This is a circuit I incorporated in my major project to drive an LCD. For C1, I used a 2.2nF ceramic disc capacitor and the resistor is 100K which based on a basic RC calculator, works out to be about 220uS, but calculators with more options (like ones requiring source voltage and output voltage as inputs to the calculator including one at http://ladyada.net/library/rccalc.html) throw me off because different voltage values output different delays.
I created this driver because I ran out of free microprocessor GPIO pins. Instead I merged the input pin (LCDCLK) with the input of a shift register, so that when the first rising edge begins, the first byte enters the shift register. Then if I do nothing for the timing window (which is a set amount of time before Q goes low which I thought equals R times C), then the LCD processes the instruction since the shift register outputs will be connected to the LCD.
I have even tried to arrange my code so the bytes get sent to the LCD as quickly as possible (which is under 25uS) then I deliberately added a 220uS delay to make sure the driver times out and makes the E line low (E is the LCD input pin which the output of this driver connects to) then I even added another 50uS delay and when I send instructions, I added a 5mS delay as well.
When I test everything, it seems that the only thing that is executed is the LCD setup instruction (38h). The LCD is a 16x2 display with a backlight.
I'm trying to figure whats wrong. I can think of these things:
The 15 LCD's I ordered online are garbage (even though upon power up with no instruction, they display a bar which is expected).
The timing window in which I send instructions to the display is bad (however, I checked the datasheet and it expects a minimum timing window of 500nS, yet it takes about 1uS to load one bit of data)
I'm using incorrect resistor/capacitor values for other reasons
I should increase delays after the timing window completes
I should add delays in updating the clock (aka use no-operation instructions between lowering the clock value and raising the value and vice-versa)?
I'm not sure the best approach to take. My microcontroller is At89C2051 which controls the above circuit, and the crystal connected to it is 20Mhz which means it takes about 590 or 600nS to execute one instruction.
I just want the LCD to execute as fast as possible. It would be golden if I can see a letter printed on the LCD within 5mS of the LCD starting up and each letter printed 250uS thereafter.
Any ideas what I can do here to make the LCD respond to all the commands instead of just one?