Newhaven Serial COG 2X16 LCD


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2008
    Posts
    31

    Default Newhaven Serial COG 2X16 LCD

    Has anyone ever used one of these serial displays before? Obviously LCDOUT wont work and neither will SEROUT nor I2CWRITE, etc. There's example code on the Data sheet at the product page, but since I'm a noob and it's not in PICBASIC I don't understand it. The display is a 4 line serial interface:

    2* RS* MPU* Register*Select*Signal.**RS=0:*instruction;*RS=1:* data*
    3* CSB* MPU* Active*LOW*Chip*Select*signal*
    4* SCL* MPU* Serial*clock
    5* SI* MPU* Input*data

    The included sample code looks pretty intimidating to me I'm just wondering if it would be much smaller In PICBasic or if I should abandon this display for now until I get more experience and go back to the tried and true parallel LCD.
    I bought this display on a whim because of its very low current ~1mA and 3 volt supply as my project is battery powered.

    I haven't even hooked up the display yet (mostly due to the 1.5mm pitch, connector on order) and tried to make it work so I'm not necessarily looking for code, just advice from the experienced here If this is not worth the effort for a noob.

    TIA
    Neo



    Sample code:

    Example*Initialization*Program*
    void init()
    //initialize the LCD
    {
    P3 = 1;
    P1 = 1;
    RST = 0; //RESET
    delay(2);
    RST = 1; //end reset
    delay(20);
    Writecom(0x30); //wake up
    delay(2);
    Call writecom(0x30); //wake up
    Call writecom(0x30); //wake up
    Call writecom(0x39); //function set
    Call writecom(0x14); //internal osc frequency
    Call writecom(0x56); //power control
    Call writecom(0x6D); //follower control
    Call writecom(0x70); //contrast
    Call writecom(0x0C); //display on
    Call writecom(0x06); //entry mode
    Call writecom(0x01); //clear
    delay(10);
    }
    void writecom(int d)
    {
    CS = 0; //CS
    RS = 0; //A0 = Command
    for(serialcounter = 1; serialcounter <= 8; serialcounter++) //send 8 bits
    {
    if((d&0x80)==0x80) //get only the MSB
    SI=1; //if 1, then SI=1
    else
    SI=0; //if 0, then SI=0
    d=(d<<1); //shift data byte left
    SCL = 0;
    SCL = 1;
    SCL = 0; //SCL
    }
    CS = 1;
    }
    void writedata(int d)
    {
    CS = 0; //CS
    RS = 1; //A0 = Data
    for(serialcounter = 1; serialcounter <= 8; serialcounter++) //send 8 bits
    {
    if((d&0x80)==0x80) //get only the MSB
    SI=1; //if 1, then SI=1
    else
    SI=0; //if 0, then SI=0
    d=(d<<1); //shift data byte left
    SCL = 0;
    SCL = 1;
    SCL = 0; //SCL
    }
    CS = 1;
    }

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: Newhaven Serial COG 2X16 LCD

    Hi,
    The PBP command to use with that display is SHIFTOUT.
    Pull the Chip Select line low, set the RS line high or low depending on if it's a command or data you're sending, the use SHIFTOUT to send the actual command (or data) to the display.

    Make sure to read up on the SHIFTOUT command in the manual, the instruction set for the LCD is in the datasheet. If you get stuck post the code and details on which chip etc you're using and I'm sure someone will be able to help.

    It looks to be a 3.3V unit, make sure you doublecheck that before trying to connect it to 5V!

    /Henrik.

  3. #3
    Join Date
    May 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: Newhaven Serial COG 2X16 LCD

    Excellent! Thank you.

    I got this LCD because it was a 3 volt unit as I have other 3 volt components in the project and I didn't want to have to resort to translators (plus I'm running out of pins on my 18 pin PIC). Which leads me to another question is "3 volt" and "3.3 volt" considered to be the same? I've actually seen data sheets use both on the same data sheet. I've also read the everything is 3 volt now and that 3.3 is older term that just keeps on going like "110 volt" household AC, which is actually all 120 volt now.

  4. #4
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Newhaven Serial COG 2X16 LCD

    Just a note, if your running your PIC at 5 volts, just use a resistor with zener diode to this display, you can get away with a tiny 3.3v zener and say a 510ohm resistor, the display uses such little amount of power its not worth it to have a seperate supply.
    Chris


    Any man who has accomplished anything in electronics at one time or another has said... " STOP! WAIT! NOOO! Dangit.... Oh Well, Time to start over..."

  5. #5
    Join Date
    May 2008
    Posts
    31


    Did you find this post helpful? Yes | No

    Default Re: Newhaven Serial COG 2X16 LCD

    Good tip 'Magic, thanks. Is 3.3 Volts and 3 Volts interchangeable?

  6. #6
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,580


    Did you find this post helpful? Yes | No

    Default Re: Newhaven Serial COG 2X16 LCD

    Always read the datasheet for the device/part in question.
    For this display it quite clearly states that Vdd can be between 2.7 and 4.5V so 3 or 3.3V are both well within spec.

    /Henrik.

Similar Threads

  1. Replies: 9
    Last Post: - 18th March 2013, 23:52
  2. Newhaven 4x40 LCD, issues!
    By MOUNTAIN747 in forum mel PIC BASIC Pro
    Replies: 27
    Last Post: - 18th October 2012, 23:23
  3. Need advice with LCD 2x16
    By fratello in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 26th April 2011, 07:58
  4. Replies: 36
    Last Post: - 14th March 2011, 19:38
  5. small 2X16 LCD
    By Ron Marcus in forum Off Topic
    Replies: 2
    Last Post: - 26th October 2007, 21:37

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts