I tried to send data to port of 8051. I have completed thisSure. Implement the UART receiver then make your main routine just send the characters back to the terminal. Simple and that avoids the additional complexity of the LCD code.
C:
#include <reg51.h>
//Function Prototype
void Uart_initialize(void);
void Send_Data(unsigned char);
void Send_String(char String[]);
/*Function to set up Uart */
void Uart_initialize (void)
{
TR1 = 0; // Stop Timer
TMOD = 0x20; // Timer 1 in mode 2 auto reload mode for baudrate generation
SCON = 0x50; // Serial Mode 1, 8-DATA bit 1-Start Bit, 1-Stop Bit, Receive Enable
TH1 = 0xFD; // Load value for 9600 baudrate
TR1 = 1; // Start Timer
}
/* Function to send a Data*/
void Send_Data(unsigned char DATA)
{
SBUF = DATA; //Load data into SBUF
while(TI == 0) //Wait untill transmission to complete
{
}
TI = 0; //Clear transmitte interrupt(TI) flag
}
/* Function to send a characters untill a null*/
void Send_String(char String[])
{
unsigned char i = 0;
while(String[i] != '\0')
{
Send_Data(String[i]);
i++;
}
}
/* Main Function*/
void main(void)
{
Uart_initialize();
Send_String("Parth");
while(1)
{
}
}

Last edited: