Newhaven Display Forum

Newhaven Products => OLEDs => Topic started by: avsa242 on January 13, 2018, 01:28:45 PM

Title: NHD-0420CW-Ax3 Scrolling Text - intended usage?
Post by: avsa242 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
    repeat i from 48 to 0
      oled.SetScrollQty (i)
      oled.Position (0, 0)
      oled.Str (string("Scrolling"))
      time.MSleep (30)

    oled.Clear

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

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!
Jesse