Bad wiring on NHD-2.7-12864WDW3

Comments

8 comments

  • Ted M.
    NHD Staff

    Hi TheogirarD,

    The reset line needs to be controlled during initialization.

    https://newhavendisplay.com/content/specs/NHD-2.7-12864WDW3.pdf

    digitalWrite(RES, LOW);  //pull /RES (pin #16) low
    delayUS(200);               //keep /RES low for minimum 200µs
    digitalWrite(RES, HIGH); //pull /RES high
    delayUS(200);               //wait minimum 200µs before sending commands
     
    Please try connecting the reset line to a GPIO and follow the initialization code below.

    void NHD12864WDY3_Init(void){
    digitalWrite(RES, LOW); //pull /RES (pin #16) low
    delayUS(200); //keep /RES low for minimum 200µs
    digitalWrite(RES, HIGH); //pull /RES high
    delayUS(200); //wait minimum 200µs before sending commands
     writeCommand(0xAE); //display OFF
     writeCommand(0xB3); //set CLK div. & OSC freq.
     writeData(0x91);
     writeCommand(0xCA); //set MUX ratio
     writeData(0x3F);
     writeCommand(0xA2); //set offset
     writeData(0x00);
     writeCommand(0xAB); //function selection
     writeData(0x01);
     writeCommand(0xA0); //set re-map
     writeData(0x16);
     writeData(0x11);
     writeCommand(0xC7); //master contrast current
     writeData(0x0F);
     writeCommand(0xC1); //set contrast current
     writeData(0x9F);
     writeCommand(0xB1); //set phase length
     writeData(0xF2);
     writeCommand(0xBB); //set pre-charge voltage
     writeData(0x1F);
     writeCommand(0xB4); //set VSL
     writeData(0xA0);
     writeData(0xFD);
     writeCommand(0xBE); //set VCOMH
     writeData(0x04);
     writeCommand(0xA6); //set display mode
     writeCommand(0xAF); //display ON

    Regards,

    0
  • TheogirarD

    Hi,
    thanks a lot for your answer ! I indeed realized that RES was missing. I also figured out another error because one of the data bus was not a gpio.
    But even with those problems solved there is still an issue...
    I can now send commands like display ON/OFF and display mode (and it works pretty well) ! But the screen doesn't seem to understand data as data ! Whatever the data I send, nothing happens.
    If I send a data byte like 0xAE it is unterstood by the OLED as a command and it shuts down (0xAE is the command for display OFF).
    I double-checked the D/C pin, it is receiving a UP (3V3). I tried adding a resistor to fix the input. May I have broken the input due to my anterior bad commands ?!
    Does the D/C pin need a resistor (I'm sending the code from a beaglebone GPIO) ?

    Here is the code I use for writeCommand

    void OLED::writeCommand(uint8_t Commande)
    {
      uint8_t Binaire(Commande);

      PinRe.write(0);
      WaitForUnbusy(100);
      for(int i(0); i<8; i++)
      {
        uint8_t masque(pow(2,i));
        bool Value(Binaire & masque);
        DataPin[i].write(Value);
      }
      ShotEnable();
      WaitForUnbusy(100);
    }

    This code is fully functionnal but the one for writeData (following) isn't... The only difference is the PinRe UP (this pin is connected to D/C) !

    void OLED::writeData(uint8_t Commande)
    {
      uint8_t Binaire(Commande);

      PinRe.write(1);
      WaitForUnbusy(100);
      for(int i(0); i<8; i++)
      {
        uint8_t masque(pow(2,i));
        bool Value(Binaire & masque);
        DataPin[i].write(Value);
      }
      ShotEnable();
      WaitForUnbusy(100);
    }

    Sorry if the problem seems trivial...

    0
  • Ted M.
    NHD Staff

    Hi TheogirarD,

    Please refer to this example code for writing to the display. 2 Pixels must be written at a time.

    void newWrite2Pixels(unsigned char xPos, unsigned char yPos, unsigned char pixel1, unsigned char pixel2){
        if(pixel1>=1) pixel1 = 0xFF;      //set 1st pixel value to ON
        else pixel1 = 0x00;      //set 1st pixel value to OFF
        if(pixel2>=1) pixel2 = 0xFF;      //set 2nd pixel value to ON
        else pixel2 = 0x00;      //set 2nd pixel value to OFF
        if(xPos>127) xPos = 127;     //boundary check (MIN xPos = 0, MAX xPos = 127)
        xPos = xPos/2;               //account for GDDRAM address mapping
        xPos+=28;                   //account for GDDRAM address mapping
        if(yPos>63) yPos = 63;       //boundary check (MIN yPos = 0, MAX yPos = 63)
        newSetColumn(xPos,xPos); //set column (x-axis) start/end address
        newSetRow(yPos,yPos);        //set row (y-axis) start/end address
        writeRAM();               //single byte command (0x5C) to initiate pixel data write to GDDRAM;
        writeData(pixel1);    //write 1st of 2 pixels to the display
        writeData(pixel2);    //write 2nd of 2 pixels to the display
    }
    void newSetColumn(unsigned char xStart, unsigned char xEnd){
        writeCommand(0x15);       //set column (x-axis) start/end address
        writeData(xStart);          //column start; 28 is left-most column
        writeData(xEnd);          //column end; 91 is right-most column
    }
    void newSetRow(unsigned char yStart, unsigned char yEnd){
        writeCommand(0x75);       //set row (y-axis) start/end address
        writeData(yStart);          //row start; 0 is top row
        writeData(yEnd);          //row end; 63 is bottom row
    }



    void newDisplayArray12864(const unsigned char arr[]){
        unsigned int i, j; 
        newSetColumn(28,91);
        newSetRow(0,63);
        writeRAM();
        for(i=0;i<1024;i++){ //translate each byte/bit into pixel data
          for(j=0;j<8;j++){
            if(((arr[i]<<j)&0x80)==0x80){
              writeData(0xFF);
            }
            else{
              writeData(0x00);
            }
          }
        }     
    }


    const unsigned char NHDlogo [] = { //128x64 monochrome bitmap, horizontal pixel arrangement, 8-pixels per byte, 1,024 bytes
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xD9, 0x83, 0xC6, 0x31, 0x98, 0xC1, 0x82, 0x0C, 0x3C, 0x63, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xD9, 0x87, 0xC6, 0x33, 0x98, 0xC1, 0x83, 0x0C, 0x7C, 0x73, 0x00, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x1D, 0x86, 0x03, 0x33, 0x18, 0xC3, 0xC3, 0x18, 0xC0, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x7F, 0xDD, 0x8E, 0xE3, 0x7B, 0x1F, 0xC3, 0x61, 0xB8, 0xFC, 0x7B, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xDF, 0x8F, 0xC1, 0xDF, 0x1F, 0xC6, 0x61, 0xB1, 0xFC, 0x6F, 0x00, 0x00, 0x00, 0x3C, 0x01, 0xC0, 0x1B, 0x84, 0x01, 0xCE, 0x18, 0xC7, 0xE0, 0xF0, 0xC0, 0x67, 0x00, 0x00, 0x00, 0x7E, 0x07, 0x9F, 0xDB, 0x87, 0xE1, 0xCE, 0x18, 0xCE, 0x70, 0xE0, 0x7C, 0x67, 0x00, 0x00, 0x00, 0x7F, 0xFE, 0x3F, 0xD9, 0x83, 0xE0, 0xCC, 0x18, 0xCC, 0x38, 0x60, 0x3C, 0x63, 0x00, 0x00, 0x00, 0xFF, 0xFC, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x01, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x3C, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x0E, 0x00, 0x3F, 0x0C, 0x3F, 0x8F, 0xC3, 0x00, 0xC3, 0x18, 0x00, 0x00, 0x00, 0x00, 0x3F, 0xFF, 0xFC, 0x00, 0x3F, 0x8C, 0x3F, 0x8C, 0xE3, 0x01, 0xC3, 0x98, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xFF, 0xF8, 0x00, 0x31, 0xCC, 0x30, 0x0C, 0x63, 0x01, 0x60, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x00, 0x30, 0xCC, 0x3F, 0x0E, 0xC3, 0x03, 0x20, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x30, 0xCC, 0x03, 0x8F, 0xC3, 0x03, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x8C, 0x3F, 0x8C, 0x03, 0x07, 0xF0, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x8C, 0x3F, 0x0C, 0x03, 0xE6, 0x18, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x83, 0x41, 0xE0, 0x70, 0x78, 0x24, 0x0C, 0x0F, 0x06, 0x0F, 0x06, 0x81, 0x80, 0x80, 0x00, 0x01, 0x83, 0xC0, 0xC0, 0xE0, 0x58, 0x34, 0x0C, 0x06, 0x06, 0x09, 0x07, 0x81, 0x80, 0x80, 0x00, 0x01, 0x82, 0xC0, 0xC0, 0xC0, 0x70, 0x3C, 0x1E, 0x06, 0x06, 0x09, 0x05, 0x83, 0xC0, 0x80, 0x00, 0x01, 0x82, 0x40, 0xC0, 0x70, 0x58, 0x2C, 0x12, 0x06, 0x06, 0x0F, 0x04, 0x82, 0x40, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    };

    Regards,

    0
  • TheogirarD

    Hello,
    Yes I'm using the whole code provided in the datasheet including draw2Pixels !
    But when I use only the init code (the one you've sent before) shows a pixel snowy pattern (attached picture).
    This is due to a bad interpretation from the screen (because there is probably something I'm doing the wrong way).
    Neither draw2Pixels nor clearDisplay are working ! Because they both require data reception. And data is understood as command...
    I checked multiple times but the pin 4 (D/C) is indeed tied to 3V3 when I try to send Data and to GND when I send command...
    Apart from data, I can successfully send each command (but the one that require data parameters are not applied)...
    Sorry if my explanations are bad...
    Thanks a lot again for your patience and your answer !

    0
  • Ted M.
    NHD Staff

    Hi TheogirarD,

    Check the D/C line to be sure it is active at the correct timing and it's going low enough to toggle the Data line.
    Try changing the GPIO pin that controls it or you can add a pull down resistor to the D/C line.

    Regards,

    0
  • TheogirarD

    Hi !
    Thanks again for your patience !
    I've purchased another screen (NHD-2.7-12864WDY3) to check if I wasn't using a broken product and... No, the result is strictly the same (the picture is attached).
    I checked with LEDs and delays increased, the lighting sequence of the pins is exactly as coded...
    I can't understand the error... Do you have any idea what could cause the weird screen (the one on the attached picture) to show up ?
    Here is the whole code I'm using :

    #include "OLEDscreen.h"
    #include <vector>
    #include <string>
    #include <cstdint>
    #include <unistd.h>
    #include <math.h>
    #include <Bela.h>
    #include <Gpio.h>


    //Test :
    #include <iostream>

    using namespace std;



    void OLED::writeCommand(uint8_t Commande)
    {
      uint8_t Binaire(Commande);
     
      for(int i(0); i<8; i++)
      {
        uint8_t masque(pow(2,i));//on genere 0001000 a la ieme position
        bool Value(Binaire & masque); //Value prend la valeur booleene du ieme bit
        DataPin[i].write(Value);//Update the pin
      }

      PinRe.write(0);
      WaitForUnbusy(100);
      ShotEnable();
      WaitForUnbusy(100);
    }

    void OLED::writeData(uint8_t Commande)
    {
      uint8_t Binaire(Commande);
     
      for(int i(0); i<8; i++)
      {
        uint8_t masque(pow(2,i));//on genere 0001000 a la ieme position
        bool Value(Binaire & masque); //Value prend la valeur booleene du ieme bit
        DataPin[i].write(Value);// Update the pin
      }

      PinRe.write(1);
      WaitForUnbusy(100);
      ShotEnable();
      WaitForUnbusy(100);
     
    }


    void OLED::ShotEnable()
    {
      PinE.write(0);
       WaitForUnbusy(100);
      PinE.write(1);
    }

    void OLED::WaitForUnbusy(int delayInUs)
    {
      usleep(delayInUs);
    }

    void OLED::initDisplay()
    {
    PinRes.write(0); //pull /RES (pin #16) low
    WaitForUnbusy(200); //keep /RES low for minimum 200µs
    PinRes.write(1); //pull /RES high
    WaitForUnbusy(200);

    writeCommand(0xAE); //display OFF
    writeCommand(0xB3); //set CLK div. & OSC freq.
    writeData(0x91);
    writeCommand(0xCA); //set MUX ratio
    writeData(0x3F);
    writeCommand(0xA2); //set offset
    writeData(0x00);
    writeCommand(0xAB); //function selection
    writeData(0x01);
    writeCommand(0xA0); //set re-map
    writeData(0x16);
    writeData(0x11);
    writeCommand(0xC7); //master contrast current
    writeData(0x0F);
    writeCommand(0xC1); //set contrast current
    writeData(0x9F);
    writeCommand(0xB1); //set phase length
    writeData(0xF2);
    writeCommand(0xBB); //set pre-charge voltage
    writeData(0x1F);
    writeCommand(0xB4); //set VSL
    writeData(0xA0);
    writeData(0xFD);
    writeCommand(0xBE); //set VCOMH
    writeData(0x04);
    writeCommand(0xA6); //set display mode
    writeCommand(0xAF); //display ON
    }


    OLED::OLED(int pinRe, int pinE, int pinRES, int dataPin[])
    {

      for(int i(0); i < 8; i++)
      {
        DataPin[i].open(dataPin[i], OUTPUT);
      }

      PinE.open(pinE, OUTPUT);
      PinRe.open(pinRe, OUTPUT);
      PinRes.open(pinRES, OUTPUT);
      PinE.write(1);
      PinRe.write(0);
     
      initDisplay();

    }


    void OLED::writeRAM()
    {
    writeCommand(0x5C);
    }

    void OLED::setColumn(unsigned char xStart, unsigned char xEnd)
    {
    writeCommand(0x15); //set column (x-axis) start/end address
    writeData(xStart); //column start; 28 is left-most column
    writeData(xEnd); //column end; 91 is right-most column
    }

    void OLED::setRow(unsigned char yStart, unsigned char yEnd)
    {
    writeCommand(0x75); //set row (y-axis) start/end address
    writeData(yStart); //row start; 0 is top row
    writeData(yEnd); //row end; 63 is bottom row
    }
    void OLED::clearDisplay(void)
    {
    setColumn(0,127); //set column (x-axis) start/end address
    setRow(0,63); //set row (y-axis) start/end address
    writeRAM(); //single byte command (0x5C) to initiate pixel data write to GDDRAM;
    for(int i=0;i<8192;i++){ // ((91-28)+1)*((63-0)+1)
    writeData(0x00);
    writeData(0x00);
    }
    }
    void OLED::draw2Pixels(unsigned char xPos, unsigned char yPos, unsigned char pixel1, unsigned char pixel2)
    {
    if(pixel1>=1) pixel1 = 0xFF; //set 1st pixel value to ON
    else pixel1 = 0x00; //set 1st pixel value to OFF
    if(pixel2>=1) pixel2 = 0xFF; //set 2nd pixel value to ON
    else pixel2 = 0x00; //set 2nd pixel value to OFF
    if(xPos>127) xPos = 127; //boundary check (MIN xPos = 0, MAX xPos = 127)
    xPos = xPos/2; //account for GDDRAM address mapping
    xPos+=28; //account for GDDRAM address mapping
    if(yPos>63) yPos = 63; //boundary check (MIN yPos = 0, MAX yPos = 63)
    setColumn(xPos,xPos); //set column (x-axis) start/end address
    setRow(yPos,yPos); //set row (y-axis) start/end address
    writeRAM(); //single byte command (0x5C) to initiate pixel data write to GDDRAM;
    writeData(pixel1); //write 1st of 2 pixels to the display
    writeData(pixel2); //write 2nd of 2 pixels to the display
    }

    void OLED::displayArray12864(const unsigned char arr[])
    { //display 128x64 monochrome bitmap, horizontal pixel arrangement, 8-pixels per byte
    unsigned int i, j;
    setColumn(28,91); //set column (x-axis) start/end address
    setRow(0,63); //set row (y-axis) start/end address
    writeRAM(); //single byte command (0x5C) to initiate pixel data write to GDDRAM;
    for(i=0;i<1024;i++)
    { //translate each byte/bit into pixel data
    for(j=0;j<8;j++)
    {
    if(((arr[i]<<j)&0x80)==0x80)
    {
    writeData(0xFF);
    }
    else
    {
    writeData(0x00);
    }
    }
    }
    }

    I also tried with a pull down resistor on D/C pin... Here is what happens on the LED when I send a data :
    1) The byte appears on the Data pins D0-7 in the right order (D0 is the first bit)
    2) The D/C pin goes up
    3) The Enable pin (which is always up) falls down to latch Data
    CS is always tied to LOW, R/W is always tied to LOW

    I'm pretty desperate, I think this will be my last attempts to get it to work... If you have any idea or suggestion about what I could try, I would gladly try it !
    Thanks !

    0
  • TheogirarD

    Hi !
    Sorry, my bad, I found the issue !
    I was maintaining the enable pin high all the time, thinking that only the falling edge was important ! It is the case in the other 6800 parallel interface that I used so I thought it was similar.
    But no, to get it to work, I have to tie up the enable pin after the data is sent on the data and after the D/C pin is correctly tied. And then I latch the data by tying low the enable pin !
    Thanks a lot for your answers. I hope this can be useful to other people ! Perhaps you could add this specification to the datasheet as the process differs from other 6800 interface such as the classic LCD Hitachi !

    0
  • Ted M.
    NHD Staff

    Hi TheogirarD,

    Thanks for your update!  It's great to hear you have it working.

    Best Regards,

    0

Please sign in to leave a comment.