#include "msp.h"
/**
* main.c
*/
//Pin assignments for P4
#define rs 0x01
#define rw 0x02
#define e 0x04
void pinAssign(){
P9->DIR |= 0xFF; //8-bit Data bus
P4->DIR |= 0x07;
}
void lcdCommand(unsigned char command){
pinAssign();
P9->OUT |= command;
P4->OUT |= e + rs;
delay(500);
P4->OUT &= ~e;
}
void lcdData(unsigned char data){
pinAssign();
P9->OUT |= data;
P4->OUT |= e + rs;
delay(500);
P4->OUT &= ~e;
}
//The idea I had was to create a function to send the data to the LCD.
void lcd_init(){
lcdCommand(0x38);
delay(200);
lcdCommand(0x0C);
delay(200);
lcdCommand(0x01);
delay(200);
lcdCommand(0x80);
delay(200);
}
void main(void)
{
WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // stop watchdog timer
lcd_init(); //Start all of the commands: 2 lines with blinking cursor.
int i = 0;
}