Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.

c
#i
include <stdio.h>
#i
include <stdlib.h>
#i
include <p18f4321.h>
# include <delays.h>
# include <CQU_LCD_Ver_2.h>
# include <usart.h>
# pragma config WDT = OFF
# pragma config LVP = OFF
# pragma config BOR = OFF
# pragma config OSC = INTIO2
void main(void) {
char char_in;
; // a character variable to store incoming c

LCDInit(();
LCDClear(();
CursorHome();
CursorMode();
DispControl();
while(1)
{
LATCbits.LATC4=0; // turn OFF D3
// Open the USART channel @ BAUD rate of 4800
OpenUSART ( USART_TX_INT_OFF &
USART_RX_INT_OFF &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
12);

while(
(!(DataRdyUSART())); //wait if no data is avai
{

char_in = ReadUSART(); // read a characte


WriteDataToLCD(char_in); // prints the incomin

CloseUSART()
); // close the channel
1.1 of 6 2022.11.25 13:39:16
C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.c

character from RS232

ilable from RS232

er from RS232
ng character to LCD

1.2 of 6 2022.11.25 13:39:16


C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.c

1.3 of 6 2022.11.25 13:39:16


C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.c
}
}

return ;
}

2.1 of 6 2022.11.25 13:39:16


C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.c

2.2 of 6 2022.11.25 13:39:16


C:/Users/piyathil/MPLABXProjects/RS232.X/RS232Out.c

2.3 of 6 2022.11.25 13:39:16

You might also like