Jump to content

Recommended Posts

Hello, I am new to to MSP environment and I would like to have some help with this project.

If this is on the wrong place of the forum or something like this please tell me so I can change it.

I tried to make things on my own but I got stuck for 2 weeks trying to get my LCD to work properly with my first MSP.

I also have acess to a friend's MSP430G2553, but the links some of the links on the forum where broken on http://43oh.com/2010/11/lcd-special-two-ways-to-interface-a-msp430-to-an-lcd/.


The conections are most probably right because I can write without problems throught Arduino, so I think the problem here is the code.
I am using CCS 6.2.


Thanks in advance and sorry for any grammar mistakes.

#include "msp430.h"
#include "intrinsics.h"
#include <stdio.h>

#define delay3s    (int)(3*750000)
#define delay2ms   (int)((2/1000)*750000)
#define delay5ms   (int)((5/1000)*750000)
#define delay100us (int)((0.1/1000)*750000)
#define RS      BIT1 //2.1
#define EN      BIT0 //2.0

//      ooooooooo   ooooo  oooooooo8  oooooooooo  ooooo            o      ooooo  oooo 
//       888    88o  888  888          888    888  888            888       888  88   
//       888    888  888   888oooooo   888oooo88   888           8  88        888     
//       888    888  888          888  888         888      o   8oooo88       888     
//      o888ooo88   o888o o88oooo888  o888o       o888ooooo88 o88o  o888o    o888o    

void envia(void);
void send_command (unsigned char cmd);
void send_data (unsigned char data);
void send_string(char *s);
void lcd_init (void);
void dado(void);

void envia(){
  P2OUT = P2OUT |  (EN);                      // define E high signal;
  __delay_cycles( delay100us);
  P2OUT = P2OUT & ~(EN);                      // define E low signal
  __delay_cycles( delay100us);

void send_command(unsigned char cmd){
  P2OUT = P2OUT &~(EN+RS);                      // define E low e define RS low - para mandar comandos 
  P1OUT &= 0xF0;                                // send higher nibble
  P1OUT |= ((cmd>>4) & 0x0F);
  envia();                                       // give enable trigger
  P1OUT &= 0xF0;                                // send lower nibble
  P1OUT |= ((cmd) & 0x0F);                   
  envia();                                       // give enable trigger

void send_data(unsigned char data){
  P2OUT |=  (RS);                      // define RS high - para mandar dados
  P2OUT &= ~(EN);
  P1OUT &=  0xF0;
  P1OUT |=  ((data>>4) & 0x0F);                 // send higher nibble
  envia();                                      // give enable trigger
  P1OUT &=  0xF0;
  P1OUT |=  (data & 0x0F);                      // send lower nibble
  envia();                                      // give enable trigger

void send_string(char *s){

void lcd_init(void){
  P2DIR |=  (EN+RS);
  P2OUT &= ~(EN+RS);
  P1DIR |=  (BIT4+BIT5+BIT6+BIT7);              //Dados
  P1OUT &= ~(BIT4+BIT5+BIT6+BIT7);              //Bits P1.4 a P1.7
  __delay_cycles( delay2ms );
  __delay_cycles( delay2ms );
  send_command(0x28);   // 4bit mode
  __delay_cycles( delay2ms );
  send_command(0x0E);   //send_command(0x0E)= display on / cursor on       send_command(0x0C) = display on / cursor off
  __delay_cycles( delay2ms );
  send_command(0x01);   // Clear LCD
  __delay_cycles( delay2ms );
  send_command(0x06);   // Incrementa o cursor automaticamente
  __delay_cycles( delay2ms );
  send_command(0x80);   // Cursor na casa inicial
  __delay_cycles( delay2ms );
  void main( void ){
  WDTCTL = WDTPW + WDTHOLD;                     // Stop watchdog timer to prevent time out reset
  send_command(0x01);   // Clear LCD
  __delay_cycles( delay5ms );
  send_string("     MSPLAY     ");
  send_command(0xC0);   // Linha 2
  __delay_cycles( delay2ms );
  send_string("By: Ivan Moraes ");
  __delay_cycles( delay3s ); //COLOCAR MÚSICA NO LUGAR DESSE DELAY


Link to post
Share on other sites

I don't have a MSP430FR2433, but a few items come to mind:

1) Does the LCD display support 3.3V input? Most Arduinos are running at 5V, but the MSP430 family is 3.3V.

2) Did you check if just wiggling a pin works? E.g. by turning on an LED or measuring with a multimeter? If that doesn't work, some additional GPIO configuration may be needed.

3) If you have a logic analyzer or oscilloscope, check if the timing of the pin wiggles is as expected. Your code seems to assume, that the clock is running at 750KHz. I don't know if that's the speed at which the FR2433 starts up without any further configuration.



Link to post
Share on other sites

1) There's one 5V pin to feed the display, the GPIOs must be operated as 5V also??

2) This is a little bit outdated code, I got to flick some LEDs after I added a command that takes down the high impedance on the GPIOs, I`ll try to get it here as soon as I get to use the desktop.

3) I don`t have an oscilloscope or a data analyzer, I`ll try to use one on my school. Anyways I am going to read throught the MSP datasheet all the way to see if I can find this.


Thanks for the reply man.

I will try to keep this post up to date so others can use this info.

Link to post
Share on other sites
  • 4 weeks later...

Hi @Tauronts

After read your post I updated an old library (I think it's similar to your library).

It's available in this Thread.

It works fine on new FR2433 launchpad. My lcd worked with 3.3v, but the contrast is very poor. You can power it with 5V from launchpad, but it can be dangerou without a level converter. If you want to test at your own risk, simply connect the RW pin to GND, so it will always work in write mode, but it's good use a level converter avoiding troubles.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...