Text orientation not changing with Extended Entry Mode Set Register
I'm using a NHD-0420CW-AG3 display.
Communication seems to be working fine.
I'm using the initialization sequence included in the datasheet:
void init()
{
RES = 1; //reset HIGH – inactive
delayms(1); //delay
command(0x2A); //function set (extended command set)
command(0x71); //function selection A
data(0x00); // disable internal VDD regulator (2.8V I/O). data(0x5C) = enable regulator (5V I/O)
command(0x28); //function set (fundamental command set)
command(0x08); //display off, cursor off, blink off
command(0x2A); //function set (extended command set)
command(0x79); //OLED command set enabled
command(0xD5); //set display clock divide ratio/oscillator frequency
command(0x70); //set display clock divide ratio/oscillator frequency
command(0x78); //OLED command set disabled
command(0x09); //extended function set (4-lines)
command(0x06); //COM SEG direction
command(0x72); //function selection B
data(0x00); //ROM CGRAM selection
command(0x2A); //function set (extended command set)
command(0x79); //OLED command set enabled
command(0xDA); //set SEG pins hardware configuration
command(0x10); //set SEG pins hardware configuration
command(0xDC); //function selection C
command(0x00); //function selection C
command(0x81); //set contrast control
command(0x7F); //set contrast control
command(0xD9); //set phase length
command(0xF1); //set phase length
command(0xDB); //set VCOMH deselect level
command(0x40); //set VCOMH deselect level
command(0x78); //OLED command set disabled
command(0x28); //function set (fundamental command set)
command(0x01); //clear display
command(0x80); //set DDRAM address to 0x00
command(0x0C); //display ON
delayms(100); //delay
}
After the initialization I am able to write "Line 1" on line 1, "Line 2" on line 2, "Line 3" on line 3 and "Line 4 on line 4.
HOWEVER,
The text is upside down.
From the forums I see that you can change this with the bottom 2 bits in the Extended Entry Mode Set register for example
command(0x2A); //function set (extended command set)
command(0x06); //COM SEG direction
command(0x28); //function set (fundamental command set)
If I use 0x04 for the Extended Entry Mode Set register
The text is upside down and text is from right to left
If I use 0x05
The text is upside down, but text is left to right
If I use 0x06
The text is upside down, but text is left to right
If I use 0x07
The text is upside down, but text is left to right
It seems like the bits in this register aren't changing things like I would expect.
I know the display can show text in the correct orientation, since there has been times before I used this initialization sequence in the datasheet where it would come up in the correct orientation after power up (I assume the bits must come up randomly after a POR)
Maybe there is a timing thing that I need to consider? Or maybe an ordering of the commands?
Any suggestions here would be great!
-
Would you be able to post a picture of what you are seeing. I will try to recreate the issue as well to see if I can find a solution.
0 -
Hi,
I am having basically the same problem. My text is upside down and mirrored, I am using the same display, and initialization code. codes 0x04 and 0x05 give the same output, as do 0x06 and 0x07. See pictures. What am I doing wrong?? Please help!0 -
Well, I figured out the problem - User error. Since the display wants LSB first (in SPI mode) and my processor sends out MSB first, I needed to reverse the bits in each byte sent. I just screwed up one of the reversals... :(
0
Please sign in to leave a comment.
Comments
3 comments