I am just beginning to use a GLCD, a New Haven Display NHD-12864MZ. The display uses a KS0108 chip set. My MCU is a 16F1519, and language is MPASM.
I have relied heavily on code from others to initialize the display and display characters. The most common code examples monitor the "busy" status, but one example simply ignores the matter and runs the MCU at 4 MHz. The latter example (**broken link removed** ) uses two NOP's between setting E and clearing it, but no busy check. I have been able to reproduce its results. It will display characters at 4 MHz, but not at 8 MHz.
Source: pdf page 52; thesis page 38:
However, in this thesis, the LCD controller is interfaced with the PIC via the I/O ports and also PIC is configured to operate at lower frequency (4MHz). As a result, the LCD status check is not required.
In contrast, bigdogguru states here:
https://www.edaboard.com/threads/239623/
Also you are using a set 10ms delay for all commands in both the LCD_ini() and LCD_data() routines, this maybe too short a delay for the initialization commands and longer than needed for the operational commands. In most LCDs the monitoring of the Busy Flag is the preferred method rather than a fixed delay when issuing operational commands.
Checking the Busy Flag makes sense, if the busy time is variable and is longer than a few MCU clock cycles. What I find quite confusing is the absence of a clear description of how long in microseconds the busy flag takes to clear between operational commands and between display data writes, if different. Some authors suggest the range for operational commands is in milliseconds, but the above dissertation clearly shows it must be shorter than that.
The datasheets from Samsung and NHD show a timing diagram in which the busy flag is high for between 1 and 3 display clock cycles. That clock cycle frequency appears to be about 1 MHz, based on the clock for the enable bit that is shown. If that is the case, then the approach used in the above reference dissertation makes sense. However, far more examples can be found in which the busy time is references as "mS" and the context is such that I assume the meaning is "millisecond," not microsecond.
How are those two descriptions of the busy flag timing reconciled?
A second and related question regards reading the display before writing to it. Under what conditions must one read the display data bus/ram (not control data) for a location before writing to it? My question is not about the dummy read to set the data latches, but rather why read, if you are going to write by moving an entire byte?
Obviously, I am very new at this and apologize beforehand for such novice questions.
John