It is way faster. I had to bit bang a serial interface to an LCD. Using the digitalwrite methods, you could watch the screen redraw. With the direct port manipulation the whole screen appeared to chage at the same time.
fll-freak:
It is way faster. I had to bit bang a serial interface to an LCD. Using the digitalwrite methods, you could watch the screen redraw. With the direct port manipulation the whole screen appeared to chage at the same time.
I haven’t been able to find any examples of serial interfaces to LCDs, for Arduino based projects.
It is an SPI interface, but it wants 9 clocks! So I bit banged the data over.
There are other serial LCD devices as well. Some are just text; others are graphic in nature. Some are I2C or SPI. Some are RS-232 or CMOS level RS-232. Lots of choices; too little time.
It is an SPI interface, but it wants 9 clocks! So I bit banged the data over.
There are other serial LCD devices as well. Some are just text; others are graphic in nature. Some are I2C or SPI. Some are RS-232 or CMOS level RS-232. Lots of choices; too little time.
I can see where color/graphics would take more time.
I haven’t played with any LCDs yet, but i have a few lying around.
fll-freak:
It is way faster. I had to bit bang a serial interface to an LCD. Using the digitalwrite methods, you could watch the screen redraw. With the direct port manipulation the whole screen appeared to chage at the same time.
Yeah, it’s way faster. But would you care to comment why the symmetry is so different?
It looks like digitalWrite() intentionally incurs a delay to make successive calls result in a 50% duty cycle.
I’m not sure why they wanted to do that. Leave that up to the user.
I can’t image the case where the authors of DigitalWrite changed its speed so that in an infinite loop it would cause a square wave. I think it just fell out that way.
One issue is that because the direct port method is it soooo much faster, you had to speed up the time scale on the scope. Now with that much detail, you are seeing the overlead of the loop. The high time is longer because that is the time the Loop routine is returning to the caller, and then getting called again.
In the other trace, that overhead is such a small part of the overall time that you can’t see the difference. Now get a very deep memory scope and pan through the data, and I will bet you see the same delta applied to the slow trace.