Custom characters on Hd44780
![roboter](https://simulide.com/p/core/modules/2c3734368b/assets/img/default_avatar.jpg)
Quote from roboter on March 26, 2024, 9:49 pmI made a video about SimulIDE
https://www.youtube.com/watch?v=hfW3rGCxj0Q&pp=ygUIc2ltdWxpZGU%3D
and stumble on a bug that custom characters did not work
It use this library https://github.com/pololu/pololu-hd44780-arduino
there 2 examples and one use loadCustomCharacters();
and with this function there nothing on display
I made a video about SimulIDE
and stumble on a bug that custom characters did not work
It use this library https://github.com/pololu/pololu-hd44780-arduino
there 2 examples and one use loadCustomCharacters();
and with this function there nothing on display
![arcachofo](https://simulide.com/p/storage/ultimatemember/2/profile_photo-80x80.png?1725763330)
Quote from arcachofo on March 27, 2024, 5:58 amHi, great video.
Thank you very much for reporting, but I'm not sure there is any problem.
Custom characters works for me.First note that pololu-hd44780-arduino library is quite old and not maintained.
That doesn't mean it should not work, but I see several problems.I used the example provided in the library: Test.ino
1- Function wait()
This is supposed to send data and wait for data from the serial port.
Is seems to use a macro (or similar): SERIAL_PORT_MONITOR
But I don't find where it is defined and in any case Serial is not initialized.
So I don't see how this is supposed to work, if you know please tell me .void wait(uint16_t id) { SERIAL_PORT_MONITOR.println(id); SERIAL_PORT_MONITOR.flush(); while(SERIAL_PORT_MONITOR.read() == -1); }
Solution:
You can try replacing wait() by delay(500) for example, or initialize and use Serial to wait for data from the user.
2- After writing to CGRAM it does not return to DDRAM:
loadCustomCharacters(); // Test both overloads of write // Expected screen: "Hello " // " " lcd.clear(); lcd.write('H'); // Here it tries to write to DDRAM, but LCD is still in CGRAM lcd.write("ello");
Solution:
Add a lcd.gotoXY before lcd.write:loadCustomCharacters(); // Test both overloads of write // Expected screen: "Hello " // " " lcd.clear(); lcd.gotoXY(0, 0); // This returns the LCD to DDRAM lcd.write('H'); lcd.write("ello");
Hi, great video.
Thank you very much for reporting, but I'm not sure there is any problem.
Custom characters works for me.
First note that pololu-hd44780-arduino library is quite old and not maintained.
That doesn't mean it should not work, but I see several problems.
I used the example provided in the library: Test.ino
1- Function wait()
This is supposed to send data and wait for data from the serial port.
Is seems to use a macro (or similar): SERIAL_PORT_MONITOR
But I don't find where it is defined and in any case Serial is not initialized.
So I don't see how this is supposed to work, if you know please tell me .
void wait(uint16_t id)
{
SERIAL_PORT_MONITOR.println(id);
SERIAL_PORT_MONITOR.flush();
while(SERIAL_PORT_MONITOR.read() == -1);
}
Solution:
You can try replacing wait() by delay(500) for example, or initialize and use Serial to wait for data from the user.
2- After writing to CGRAM it does not return to DDRAM:
loadCustomCharacters();
// Test both overloads of write
// Expected screen: "Hello "
// " "
lcd.clear();
lcd.write('H'); // Here it tries to write to DDRAM, but LCD is still in CGRAM
lcd.write("ello");
Solution:
Add a lcd.gotoXY before lcd.write:
loadCustomCharacters();
// Test both overloads of write
// Expected screen: "Hello "
// " "
lcd.clear();
lcd.gotoXY(0, 0); // This returns the LCD to DDRAM
lcd.write('H');
lcd.write("ello");
![roboter](https://simulide.com/p/core/modules/2c3734368b/assets/img/default_avatar.jpg)
Quote from roboter on March 27, 2024, 6:52 pm1- Function wait()
SERIAL_PORT_MONITOR is defined in pins_arduino.h
#define SERIAL_PORT_MONITOR Serial
but yes it missing
SERIAL_PORT_MONITOR.begin(9600);
2- After writing to CGRAM it does not return to DDRAM:
there also
lcd.clear();
but yes with
lcd.gotoXY(0, 0); // This returns the LCD to DDRAM
it started to workI will later try on real hardware and make another video 🙂
1- Function wait()
SERIAL_PORT_MONITOR is defined in pins_arduino.h#define SERIAL_PORT_MONITOR Serial
but yes it missing
SERIAL_PORT_MONITOR.begin(9600);
2- After writing to CGRAM it does not return to DDRAM:
there also
lcd.clear();
but yes with
lcd.gotoXY(0, 0); // This returns the LCD to DDRAM
it started to work
![](https://simulide.com/p/storage/userfiles/roboter/posts/202403271711565517.png)
I will later try on real hardware and make another video 🙂
![arcachofo](https://simulide.com/p/storage/ultimatemember/2/profile_photo-80x80.png?1725763330)
Quote from arcachofo on March 27, 2024, 7:01 pmlcd.clear();
I will later try on real hardware and make another video
I was thinking about that...
In the datasheet seems that lcd.clear() only resets the DDRAM pointer, but could be that it also changes mode to write to DDRAM.
If you test it in real hardware it would be great!If right after writing to CGRAM, lcd.clear() without lcd.gotoXY() works in real hardware then there is a bug in SimulIDE.
Please let me know what you find.
lcd.clear();
I will later try on real hardware and make another video
I was thinking about that...
In the datasheet seems that lcd.clear() only resets the DDRAM pointer, but could be that it also changes mode to write to DDRAM.
If you test it in real hardware it would be great!
If right after writing to CGRAM, lcd.clear() without lcd.gotoXY() works in real hardware then there is a bug in SimulIDE.
Please let me know what you find.
![roboter](https://simulide.com/p/core/modules/2c3734368b/assets/img/default_avatar.jpg)
![arcachofo](https://simulide.com/p/storage/ultimatemember/2/profile_photo-80x80.png?1725763330)
![roboter](https://simulide.com/p/core/modules/2c3734368b/assets/img/default_avatar.jpg)