1
OLEDs / Reading a register?
« on: June 03, 2018, 01:58:48 PM »
Hi,
How would one read a register's contents? I'm trying to simplify my driver for the NHD-0420CW-AY320. Because some of the US2066 registers combine functionality of more than one setting, I initially wrote my driver the same way. For example, the common and segment bi-direction function are bits set in the same register, so I wrote my high-level function in a similar way: SetComSegBiDirection(com, seg). I'd like to separate things like this out, so in order to do it properly, if I want to for example change the 'seg' bi-direction only, I'd need to first read the settings of the register from the US2066 in order to preserve the current setting of the 'com' bit, then write the OR'd settings back to the US2066. I realize I could maintain a separate copy of the register settings on my MCU before writing them in the first place, but my feeling is it's better to query the display controller for the setting instead.
It wasn't obvious to me looking at the datasheet how to read a register - only how to read DDRAM/CGRAM.
Thanks!
EDIT: I forgot to mention: I connect using I2C
How would one read a register's contents? I'm trying to simplify my driver for the NHD-0420CW-AY320. Because some of the US2066 registers combine functionality of more than one setting, I initially wrote my driver the same way. For example, the common and segment bi-direction function are bits set in the same register, so I wrote my high-level function in a similar way: SetComSegBiDirection(com, seg). I'd like to separate things like this out, so in order to do it properly, if I want to for example change the 'seg' bi-direction only, I'd need to first read the settings of the register from the US2066 in order to preserve the current setting of the 'com' bit, then write the OR'd settings back to the US2066. I realize I could maintain a separate copy of the register settings on my MCU before writing them in the first place, but my feeling is it's better to query the display controller for the setting instead.
It wasn't obvious to me looking at the datasheet how to read a register - only how to read DDRAM/CGRAM.
Thanks!
EDIT: I forgot to mention: I connect using I2C