I studied the basic of uart communication. Following is program for uart communication
8051 micro-controller, keil, LCD 16*2
Now I just want to send data from micro-controller to LCD but I am stuck here I don't know how to do it
I can also write code for following function
C:
#include <reg51.h> /* Include x51 header file */
void UART_Init()
{
TMOD = 0x20; /* Timer 1, 8-bit auto reload mode */
TH1 = 0xFD; /* Load value for 9600 baud rate */
SCON = 0x50; /* Mode 1, reception enable */
TR1 = 1; /* Start timer 1 */
}
void Transmit_data(char tx_data)
{
SBUF = tx_data; /* Load char in SBUF register */
while (TI == 0); /* Wait until stop bit transmit */
TI = 0; /* Clear TI flag */
}
void String(char *str)
{
int i;
for(i = 0; str[i] != 0; i++) /* Send each char of string till the NULL */
{
Transmit_data(str[i]); /* Call transmit data function */
}
}
void main(void)
{
UART_Init(); /* UART initialize function */
String("hello"); /* Transmit 'test' */
while(1);
}
Now I just want to send data from micro-controller to LCD but I am stuck here I don't know how to do it
I can also write code for following function
- STEP1: Initialization of LCD.
- STEP2: Sending command to LCD.
- STEP3: Writing the data to LCD