NHD‐0420CW‐AG3 + I2C + PIC assembly code: trouble getting started

Comments

4 comments

  • Saurabh_B

    Richard,
    Have you initialized the display?

    This display does have a lengthy initialization sequence that needs to occur to setup the registers on the display controller.

    0
  • RichardR
    Hello Saurabh,

    Quote
    This display does have a lengthy initialization sequence that needs to occur to setup the registers on the display controller.
     

    No, I did not initialize the display -- I assumed that it would default to a simple 4x20 character mode, like most other displays I worked with. Also, I thoroughly read both the NHD-0420CW-AG3 and the US2066 datasheets, and the only reference to initialization I can find has to do with the RES# pin: "When the pin is pulled LOW, initialization of the chip is executed."
    The code examples don't mention any initialization either.
    Am I using the wrong datasheets? Because that would explain a lot...

    Where can I find information about this initialization sequence? On pages 15-16 of the US2066 datasheet, a Power ON and OFF sequence is mentioned, but that deals with several different voltages for the US2066 controller (VDDIO, VDD, VCC etcetera) -- while the actual display unit only has one VDD connection. So I assume this is dealt with internally. The only commands here are 0Ch for On and 08h for Off -- neither of which do anything visible here. Is there perhaps some sort of simple test mode?

    And what initialization sequence should I use to get a 4 x 20 display? And is there some document that explains about the IS, RE and SD command bits?

    Sorry if I ask a lot of questions, but I really can't find any answers in the datasheets that I have here.

    Thank you for your reply,

    Best regards,
    Richard
     
    « Last Edit: December 15, 2015, 04:43:56 PM by RichardR »
    0
  • Saurabh_B

    Richard,

    On pages 21 and 22 of the datasheet for the display you can find an example program that will drive this display. In the program you have the recommended initialization sequence. This will set the necessary registers required for the display to work.

    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
    }

    You can also reference the program in the following link to help you get the display up and running.
    https://github.com/NewhavenDisplay/NHD_US2066

    0
  • RichardR

    Ah, OK, I surmised that this was a demo program to show how different functions are addressed -- I never realized that this initialization sequence was actually necessary for proper functioning of the display.

    Thank you for clarifying this! (Although it might be handy if the datasheet mentioned that this initialization is actually more than just an example -- it is vitally important.)

    OK, at least I know what to transmit -- so now I can get on with debugging my I2C code.

    Thanks again for the heads-up!

    Best regards,
    Richard

    0

Please sign in to leave a comment.