Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - avsa242

Pages: [1]
OLEDs / Reading a register?
« on: June 03, 2018, 01:58:48 PM »

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.


EDIT: I forgot to mention: I connect using I2C

OLEDs / NHD-0420CW-Ax3 Scrolling Text - intended usage?
« on: January 13, 2018, 01:28:45 PM »
Hi everyone,

I'm trying to implement the text scrolling functionality of this display/controller in my driver and I have it basically working, but I'm having difficulty determining if I'm really using it correctly.

First, before I started implementing it, I got the impression the number of pixels to scroll was relative, i.e., if I kept issuing a command to scroll 1 pixel, that it would keep scrolling by one more pixel every time, however, it seems that the number of pixels to scroll is an absolute value, i.e., it would shift the display by 1 pixel the same location every time, or if 48 pixels, it'd be the same location every time. I hope this isn't too difficult to understand, but does this sound correct?

Secondly, if I do have the basic understanding correct, then would someone be able to suggest a short example, even pseudocode? Here's a snippet I have right now:
Code: [Select]
    repeat i from 48 to 0
      oled.SetScrollQty (i)
      oled.Position (0, 0)
      oled.Str (string("Scrolling"))
      time.MSleep (30)


    repeat i from 48 to 0
      oled.SetScrollQty (i)
      oled.Position (10, 0)
      oled.Str (string("Scrolling"))
      time.MSleep (30)

This is written in SPIN. repeat used here would be equivalent to a "for (i=0; i < 49; i++)"-loop (and another in the opposite direction) in C. The rest I think should be pretty self-explanatory, except I'll mention that oled.SetScrollQty pokes the us2066 Set Scroll Quantity register (0x80). So the bytes that go out are (0x80 | i). The string "Scrolling" does scroll across the display using this code, but because there is only a maximum of 48 pixels scroll, I have to change the DDRAM address (oled.Position) after the first loop and repeat the process, in order to make it appear that the string is smoothly scrolling across the whole display. This is really where I'm asking for help, and to re-iterate, if I'm even using the functionality the way it's intended (if not, please let me know - I'd rather implement it the way it's intended to be used, at least at first).

Lastly, I'll add I'm currently doing this with double height text disabled, though I've tried it with it enabled as well, with the same results.

Thanks very much!

HI folks,

I recently bought one of these in yellow and wanted to get it running with Parallax's P8X32A microcontroller ( I wrote a driver/object for interfacing with the display over I2C (tested ~1kHz-400kHz), but plan to try an SPI version as well. It includes demo code, as well (for the uninitiated, everything is written in SPIN - a language of Parallax's design).

I've put the code up on github for anyone that may be interested (MIT license) at: as well as a video of the demo code, for those that may not have a Prop:

Cheers, and thanks Newhaven for these nice display modules!

Pages: [1]