Hi All,
New here, I had a question (I searched, but couldn't find any thread similar.) I was wondering if anyone was willing to help me troubleshoot on why my LCD 16x2 isn't receiving the commands. I'm just trying to turn on the cursor and display two lines:
I'm experimenting with the MSP432 microcontroller. Thanks in advance. And please tell or point me to the proper etiquette of posting here.
New here, I had a question (I searched, but couldn't find any thread similar.) I was wondering if anyone was willing to help me troubleshoot on why my LCD 16x2 isn't receiving the commands. I'm just trying to turn on the cursor and display two lines:
C:
#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;
}
I'm experimenting with the MSP432 microcontroller. Thanks in advance. And please tell or point me to the proper etiquette of posting here.