) But anything accurate and reproducible? Use appropriate resources in your MCU, such as timers, or other peripherals - if you typically need to bit bang GPIOs with accurate timings, there's usually a peripheral that will do this for you. If there isn't anything that quite fits (for instance, because you need to toggle some GPIOs with a specific timing relationship relative to, say, some SPI peripheral), there are now many MCUs out there that have a peripheral chaining ability (called in various ways, usually under the name of "trigger" something), with which you can trigger a peripheral from another one. So for instance, you can configure your MCU to trigger a SPI transfer from a PWM output, for instance, which you could use in a single-shot mode. Read datasheets, and use hardware features as much as you can when accurate timings are involved. Or use an old 8-bitter with 100% predictable and reproducible timings down to the cycle for any operation. Your pick. =)When counting clock cycles and proving cycle accuracy, we often fail to see the forest from the trees: the fact that actual time, in seconds and not clock cycles, is all that matters, and in physical world, jitter and uncertainty is always there, we just need to define what we can accept. Even XMOS has jitter, just maybe ~2-3 orders of magnitude less than a bare metal Cortex M7 application, which again has maybe ~2-3 orders of magnitude less jitter than one written by inexperienced trainee using example codes and libraries.
Well they do go all out to make it confusing, having declared the minimum low time to be 80µs when checking the busy flag they then state that the clock cycle is to be 1.2µs so it's also a 2 speed clock based on what you are doing.
I agree it seems confusing. I've only had a relaitively quick look at the datasheet, so could easily be confused/wrong, myself. But I attempt to explain why there are fast, around 1MHz/1µs elements, and much slower 80µs/1ms/100's of ms timing things.
The 'fast' (if you call 1MHz/1µs fast these days!) timings are the actual hardware interface timings itself. Which seems to prefer to have a clock which is regularly active. I.e. some kind of low level serial/parallel etc, hardware peripheral chips.
The much slower timings, such as the 80µs, for the busy flag to be active. Are probably the (worst case scenario, with suitable active clock(s) and active enable signals) time the displays internal MCU and/or graphics cpu/hardware takes (via software/microcode/hardwired-graphics/character-functions), to perform the requested tasks.
E.g. 80µs to set/reset the busy flag, or many milliseconds (and much, much longer) to perform more complicated display functions.
what is confusing is pages 27 and 28 versus page 30. 27 is the 4 bit mode, very clearly the clock is shown to be unequal in high/low with emphasis on the low time after the display has started executing the instruction so that the data is asserted and the busy flag returned. In the 8 bit mode it shows equal high/low periods with again emphasis on the time to wait for a valid busy flag. this delay is a whopping 80µs, but coincidentally the data setup time to read data is 80ns which I assume is what you would call this period. the data is accepted and the bus interface sets the busy flag.
The issue would be that if the busy flag is checked less than the 80µ/ns later it would not yet be asserted so the MPU would think the display is clear to take more data when it is just starting to respond to the instruction.
Then going to page 30 you have the diagram of timing of sending data with the timings table on page 32. This is where the data hold time is shown in ns and the whole clock cycle is said to be 1.2µs. It really feels like there is an error.
assuming these displays were meant to work on a standard bus with other devices surely the Bus master cannot be expected to change the clock just to suit the display. I take this to mean that the clock must have a cycle time of at least 1.2µs or no more than 800kHz.
What is also evident is that the clock being the enable cannot be free running to every device on this bus so presumably and given it's name "enable" the clock was akin to the CS pin on SPI devices but it doubled up as the clock. I assume there was some address multiplexer in the system that the bus master would put an address to and that would route the clock to the desired device.
Is there a standard anywhere for this bus?
The 37µs instruction execution time is 10 clock cycles of the display controller.
No it's not that simple I am afraid
The entire instruction is usually executed in 37µs
So i still do not see where the 80µs comes from as it is so much longer than all other timings
This chip is used on a display module I am using from newhaven. I'm not actually putting this chip on a PCB myself or making any of the functional choices, but the newhaven datasheet refers to this one.
..
..
<SNIP>
The original hitachi driver datasheet: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf does not seem to mention the delay for checking the busy flag. But they mention that for 4 bit operation 2 cycles are needed to check the busy flag.... So this delay may still be a thing but now it is unmentioned, so there is a particular clock cycle that is done one pulse at a time, then there is a delay between pulses, my what a flipping mess this looks like. Now I know why I really wanted the serial displays but they were all sold out.
I take it no one knows if anyone ever wrote a library in C for these displays? you know one that can actually be understood with instructions?
I tried googling for more explanations on the chip, for you. There is not much, but I did find this:
https://electronics.stackexchange.com/questions/535092/programming-an-lcd-interface-with-a-st7066u
... The 2MHz is clearly bollocks as the timing clearly states a 1.2µs cycle which is 833kHz not to mention the 6.25kHz speed if we use the 80µs figure.
...
... The 2MHz is clearly bollocks as the timing clearly states a 1.2µs cycle which is 833kHz not to mention the 6.25kHz speed if we use the 80µs figure.
...
Besides the 80µs, which I agree is crazy, I suspect the 2MHz bus cycle claim may be correct, and it is the min cycle time that is bollocks. Probably should be 500ns, as it is for say KS0076.
You mentioned that you were going to use a display with a serial interface, but those become impossible to find. I think there's a reason why you can still buy the parallel-interface parts ...
And yeah, I wrote a C library to talk to them, for SiLabs 8-bit parts. Obviously that bit-bang can't be directly translated to an ARM.
You mentioned that you were going to use a display with a serial interface, but those become impossible to find. I think there's a reason why you can still buy the parallel-interface parts ...
... The 2MHz is clearly bollocks as the timing clearly states a 1.2µs cycle which is 833kHz not to mention the 6.25kHz speed if we use the 80µs figure.
...
Besides the 80µs, which I agree is crazy, I suspect the 2MHz bus cycle claim may be correct, and it is the min cycle time that is bollocks. Probably should be 500ns, as it is for say KS0076.
The problem I start to have here is how can the MPU bus be 2MHz when the display controller clock es always 270kHz or there abouts? I can only assume they are trying to say that the chip will tolerate the timings of 2MHz for the sake of other chips on the same bus but in fact if the 80µs is anything like true then unless you want to keep messing about with re-timing the clock cycle by cycle you may as well call it 6.25kHz, but if you have to run the clock at 6.25kHz then that's not 2MHz as nothing else will move any faster than the clock.
there is not much of a conflict width the 2MHz, I just assume it is copy and pasted BS. The enable cycle is said to be at least 1.2µs, that is no more than 833kHz, that is the fastest thing going. Then there is this 80µs wait time but that does not have to affect the overall clock timing for the whole bus as it just means the MPU must not send the clock for 80µs after the data is latched. but still the abs top bus speed here is 833kHz. I will probably run on something like 6.25kHz anyway, even with it taking 2 cycles to put a character on the display that is 78 refreshes a second which is plenty.