Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Display message in LCD with MSP430

$
0
0

Hello,

 

So I have been working with my project and so far I have made all soldering and connections between the MSP430 and the LCD chosen.

The LCD chosen was the: NHD-0216HZ-FSW-FBW-33V3C Character Liquid Crystal Display Module.  2 Lines x 16 Characters and it has a Built‐in controller (ST7066U or equivalent)

 

I have it connected for a 4 bit Initialization on the MSP430, I have provided pictures of how its looking as of now.

In the datasheet I saw the 4 bit initialization pseudocode and I am working the project on assembly language on IAR, my question is how can I convert this code to assembly language so I can display something succesfully on the LCD display with the MSP430.

 

I would appreciate any help, thank you in advance.

 

Pseudocode (4-bit Initialization) from the Datasheet:

 

4-bit Initialization:
/**********************************************************/
void command(char i)
{
P1 = i; //put data on output Port
D_I =0; //D/I=LOW : send instruction
R_W =0; //R/W=LOW : Write
Nybble(); //Send lower 4 bits
i = i<<4; //Shift over by 4 bits
P1 = i; //put data on output Port
Nybble(); //Send upper 4 bits
}
/**********************************************************/
void write(char i)
{
P1 = i; //put data on output Port
D_I =1; //D/I=HIGH : send data
R_W =0; //R/W=LOW : Write
Nybble(); //Clock lower 4 bits
i = i<<4; //Shift over by 4 bits
P1 = i; //put data on output Port
Nybble(); //Clock upper 4 bits
}
/**********************************************************/
void Nybble()
{
E = 1;
Delay(1); //enable pulse width >= 300ns
E = 0; //Clock enable: falling edge
}
/**********************************************************/
void init()
{
P1 = 0;
P3 = 0;
Delay(100); //Wait >15 msec after power is applied
P1 = 0x30; //put 0x30 on the output port
Delay(30); //must wait 5ms, busy flag not available
Nybble(); //command 0x30 = Wake up
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #2
Delay(10); //must wait 160us, busy flag not available
Nybble(); //command 0x30 = Wake up #3
Delay(10); //can check busy flag now instead of delay
P1= 0x20; //put 0x20 on the output port
Nybble(); //Function set: 4-bit interface
command(0x28); //Function set: 4-bit/2-line
command(0x10); //Set cursor
command(0x0F); //Display ON; Blinking cursor
command(0x06); //Entry Mode set
}
/**********************************************************/

Attached Thumbnails

  • IMG_1400.JPG

Viewing all articles
Browse latest Browse all 2077

Trending Articles