1
OLEDs / Shift position after "clear screen" instruction
« on: September 17, 2015, 12:30:54 AM »
On the NHD-0420CW, is the shift position expected to be restored to 0 when issuing a "clear screen" instruction (command 0x01)? What about "return home" when the display is off (the "D" bit in the "Display ON / OFF Control" command)? I'm seeing some very strange behavior.
After completely powering off the module (0 volts, all capacitors drained), I power it on and issue these commands:
I expect that all four characters will be on the left side of the screen (or right, because it is reversed), but instead I see them split: two on the left and two on the right.
This behavior is very fragile. In *only* happens after a power-on. After asserting the reset pin, the same command sequence gives the proper result. Also, small changes to the code fix it. For example, replacing the
Can anyone else replicate this behavior? I am using I2C.
After completely powering off the module (0 volts, all capacitors drained), I power it on and issue these commands:
Code: [Select]
// Set 4-line mode
command(0x3A);
command(0x09);
command(0x38);
// Display off
command(0x08);
// Clear screen
command(0x01);
// Display on
command(0x0C);
// Write two characters at current location.
data(0x30);
data(0x41);
// Move to second line and write two more characters.
command(0xA0);
data(0x32);
data(0x42);
I expect that all four characters will be on the left side of the screen (or right, because it is reversed), but instead I see them split: two on the left and two on the right.
This behavior is very fragile. In *only* happens after a power-on. After asserting the reset pin, the same command sequence gives the proper result. Also, small changes to the code fix it. For example, replacing the
Code: [Select]
command(0x08)
with Code: [Select]
0x08,0x0C,0x08
(display off, on, off) fixes it. Issuing a Code: [Select]
command(0x02)
(return home) fixes it, but only if it is *after* Code: [Select]
command(0x08)
.Can anyone else replicate this behavior? I am using I2C.