kawal_547
Newbie level 5
Hi,
I am working on PIC18F65k22. I am getting problem in UART2 Reception Mode.
UART1 transmission is OK
UART1 RECEption is OK
UART2 Transmission is oK
I am sending you the program
char uart_rd;
void main()
{
Delay_ms(1000);
UART2_INIT();
UART2_Write_Text("UART2 tESTING");
while(1)
{
UART2_Write_Text("USART2 Testing");
if (UART2_Data_Ready())
{ // If data is received,
uart_rd = UART2_Read(); // read the received data,
UART2_Write(uart_rd); // and send data via UART
}
}
}
void USART2_INIT()
{
ANCON2.ANSEL18=0; //Digital Pin RX2/AN18
ANCON2.ANSEL19=0; //Digital Pin TX2/AN19
CM3CON.CON=0; //Comparator is Disabled
ODCON3=0; //Open Drain Capability Disable
RCSTA2.SPEN=1; //Serial Port Enable
TRISG.RG2=1; //RG2/Rx2 ia made Input
TRISG.RG1=0; //RG1/TX2 ia made Output
UART2_Init(9600);
}
I am working on PIC18F65k22. I am getting problem in UART2 Reception Mode.
UART1 transmission is OK
UART1 RECEption is OK
UART2 Transmission is oK
I am sending you the program
char uart_rd;
void main()
{
Delay_ms(1000);
UART2_INIT();
UART2_Write_Text("UART2 tESTING");
while(1)
{
UART2_Write_Text("USART2 Testing");
if (UART2_Data_Ready())
{ // If data is received,
uart_rd = UART2_Read(); // read the received data,
UART2_Write(uart_rd); // and send data via UART
}
}
}
void USART2_INIT()
{
ANCON2.ANSEL18=0; //Digital Pin RX2/AN18
ANCON2.ANSEL19=0; //Digital Pin TX2/AN19
CM3CON.CON=0; //Comparator is Disabled
ODCON3=0; //Open Drain Capability Disable
RCSTA2.SPEN=1; //Serial Port Enable
TRISG.RG2=1; //RG2/Rx2 ia made Input
TRISG.RG1=0; //RG1/TX2 ia made Output
UART2_Init(9600);
}