TI msp430 with LCD screen

Thread Starter

crobertsbmw

Joined Sep 7, 2011
28
I have a TI MSP430x2274 that I am trying to interface with an LCD (http://shop.moderndevice.com/products/3-3v-16-x-2-blue-lcd-character-display). I have it all wired up, but I can't get anything to show up. I wonder just a little bit if they sent me a 5volt version and not the 3.3 volt version and I don't have high enough voltage for the contrast or something. Or maybe something is wrong with my code. The code is an adaptation of the sample code from newHaven Display. I compared the two data sheets and they seem to be exactly the same. Any other ideas why I might not be able to get anything written to this LCD?

Here is my code:
Rich (BB code):
//---------------------------------------------------------
/*
8_bit_character.c
Program for writing to character LCD
*/
//---------------------------------------------------------
//#include <lcdTest.h>

#include "msp430x22x4.h"
#include "eZ430X.h"
//---------------------------------------------------------
//
//#define E     P3_4;
//#define D_I     P3_0;
//#define R_W     P3_7;
//******************************************************************************

char const text1[] = {"Test Program    "};
char const text2[] = {"Character LCD   "};

void Delayms(int n){
    int i;
    int j;
    for (i=0;i<n;i++)
        for (j=0;j<1500;j++)
        {;}
}

void command(char i){
    P1OUT = i;
    P3OUT &= ~0x01;        //P3_0 =0;
    P3OUT &= ~0x80;        //P3_7 =0;
    P3OUT |= 0x40;        //e P3_6  = 1;
    Delayms(1);
    P3OUT &= ~0x40;        //P3_6  = 0;
}
void write(char i){
    P1OUT = i;
    P3OUT |= 0x01;        //P3_0 =1;
    P3OUT &= ~0x80;        //P3_7 =0;
    P3OUT |= 0x40;        //P3_6  = 1;
    Delayms(1);
    P3OUT &= ~0x40;        //P3_6  = 0;
}
void init(){
   // P3OUT &= ~0x10;        //E = P3_4  = 0;
    P3OUT &= ~0x40;     //E = P3.6 = 0;
    Delayms(5);
    command(0x30);
    Delayms(100);
    command(0x30);
    Delayms(10);
    command(0x30);
    Delayms(10);
    command(0x38);
    command(0x10);
    command(0x0c);
    command(0x06);
}
void home(){
    command(0x01);
    Delayms(5);
}
void nextline(){
    command(0xc0);
}
void disp_pic(){
    int i;
    home();
    for (i=0;i<16;i++){
        write(text1);
    }
     nextline();
     for (i=0;i<16;i++){
        write(text2);
    }
}


void main(void) {
    WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
    P1DIR = 0xFF; //set p1.0-p1.7 as output
    P3DIR |= 0xC1; //set p1.0 p1.6 and p1.7 as output
    P1OUT = 0x00;
    P3OUT = 0x00;
    while(1){
        init();
        disp_pic();
        Delayms(1000);
    }
}

 
Last edited by a moderator:

MMcLaren

Joined Feb 14, 2010
861
The datasheet says it's 5 volts. Did you contact their customer support?

While I can interface to my HD44780 compatible LCD displays with 3.3v signals from my Launchpad, I still have to power the displays from 5 volts.

Some people suggest you may be able to power these 5v displays from 3.3v but you may have to come up with a negative voltage for the contrast adjustment.

Cheerful regards, Mike
 

Thread Starter

crobertsbmw

Joined Sep 7, 2011
28
I bought the 3.3 volt version, and it just shares the same datasheet as the 5volt version. But I am still a little baffled. I wonder if they sent me the wrong one...
 
it depends how you hooked up the lcd, if using 6 pin or 12 pin mode, you have to check the busy flag of the display before writing any new data. as the msp430 runs on 16mhz this is much to fast for the display.
A better solution is using a 2 wire interface and shift register 74hc164 as writing this way to the display is slow enough so that you not need to test the display's busy flag, and it saves you plenty of mcu pins.
The difference between a 5v lcd and a 3v lcd is only a resistor ! when you measure on pin 2(5v vdd) of the display it goes to a 4k7 resistor... simply solder a tiny wire over it and voila , your 5v display works now on 3v3 (of course don't put 5v as power supply now !)
don't forget google is your friend
 
Top