-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hd44780 not working in 4-bit mode with the LCD from Arduino Starter Kit #646
Comments
In 8-bit mode (code here, wokwi-simulation), it works on the HW LCD from the Arduino starter kit, but not in the simulation. |
- Write only the high-part of the byte when configuring in 4-bit mode similar to the LiquidCrystal library around [here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L116) - Pulse enable after writing data similar to the LiquidCrystal library: [4-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L312), [8-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L320) Addresses issue [tinygo-org#646](tinygo-org#646).
- Write only the high-part of the byte when configuring in 4-bit mode similar to the LiquidCrystal library around [here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L116) - Pulse enable after writing data similar to the LiquidCrystal library: [4-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L312), [8-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L320) Addresses issue [tinygo-org#646](tinygo-org#646).
- Write only the high-part of the byte when configuring in 4-bit mode similar to the LiquidCrystal library around [here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L116) - Pulse enable after writing data similar to the LiquidCrystal library: [4-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L312), [8-bits here](https://github.com/arduino-libraries/LiquidCrystal/blob/1.0.7/src/LiquidCrystal.cpp#L320) Addresses issue [tinygo-org#646](tinygo-org#646).
It seems i'm encountering the same issue. Arduino code works in 4 bit mode but the tinygo example isn't working on it. I'm attempting to construct a setup for 8 bit mode, will update here with my findings. |
The display I'm currently testing with is an older VFD type display. It does work with arduino code, when i write one character at a time and introduce a small delay between writes. I will come back and add to this issue a test on a more modern display when i get around to it. Seems I'm getting panic on lcd.Display() with the following code, in 8 bit mode
a serial monitor program which accompanies this
Testing output
video_2024-02-16_19-44-44.mp4 |
If this panic is without it, could you please try with the proposed fix (#647) for this issue?
to the For me the the fix worked in both 4-bit and 8-bit mode with the LCD from the Arduino starter kit and the virtual one on wokwi.com. |
There were a few issues with the code in my previous comment, but after fixing those I could never get past After many attempts, i ended up copying the whole driver into the modified example code. I was then able to just create a GPIO and use write8BitMode as follows
and it works! (the characters need to be remapped) perhaps there can be a more generic way of integrating this workaround into an example to support older displays. If the GPIO struct fields were exported, it would be possible to do this. |
I can confirm now that the example driver works for me in both 4 and 8 bit mode with a modern 16X2 LCD. I had misconfigured the contrast PWM, which was not actually part of that example. After adding that, the text became visible. |
The code exhibiting the problem is pretty much a hello-world type (from here)
It happens with latest version (
v0.26.0
), on both:The easiest way to reproduce the issue is with a virtual circuit on wokwi.com (such as this one), by pressing
F1
there, then selectingUpload Firmware and Start Simulation
and uploading thetinygo
built hex file. The mis-behavior is of random "gibberish" showing up on the LCD.Th expected behavior of the virtual circuit should be like exhibited by this one - programmed with the Arduino LiquidCrystal library.
Possibly related to #380?
The text was updated successfully, but these errors were encountered: