Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
If this is your problem (sending data from controller to PC) , here's a sample program.now the problem how to write the coding to send the data to rs232
// USART0 initialisation
void USART0_Init(unsigned short int F_CPU_MHz, unsigned short int Baud_Rate)
{
/*****************************************************************************************************************
Description: Initialize the UART0 hardware with the required BaudRate
Input: Frequency of the Microcontroller, Desired BaudRate
Output: None
*****************************************************************************************************************/
UCSR0B = 0x00; // Disable while setting baud rate
UCSR0A = 0x00; // Disable USART flags
UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00); // 8-Bit data, 1-Bit Stop
UBRR0L = ((F_CPU_MHz*1000000)/Baud_Rate/16)-1; // Set Baud Rate Lo - Asynch Normal Mode
UBRR0H = 0x00; // Set Baud Rate Hi
UCSR0B = (1<<RXEN0)|(1<<TXEN0); // Enable USART TX and RX
}
// Send a single byte to the computer
void Send_Byte(char data)
{
/*****************************************************************************************************************
Description: Send a single byte on the UART port
Input: A character to be sent
Output: None
*****************************************************************************************************************/
while ((UCSR0A & (1<<UDRE0)) == 0);
UDR0 = data;
}
// Receive a single byte from the computer
char Receive_Byte(void)
{
/*****************************************************************************************************************
Description: Receive a single byte on the UART port
Input: None
Output: A character with the received byte
*****************************************************************************************************************/
while((UCSR0A&(1<<RXC0)) == 0);
return UDR0;
}