Hi,
I am using USART with the PIC18F4550 and Visual Studio. Can someone help me find what is causing errors in the coding below please?
Also, is there a neater way to to this?
Thanks in advance.
I am using USART with the PIC18F4550 and Visual Studio. Can someone help me find what is causing errors in the coding below please?
Code:
void main(void)
{
Configurate_USART();
char Temp_Instruction;
while(1)
{
if(PIR1bits.RCIF == 1) // if the USART receive interrupt flag has been set
{
Temp_Instruction = RCREG;
if(Temp_Instruction == 'a')
{
LATBbits.LATB0 = 1; // RB-0 to High
LATBbits.LATB1 = 1; // RB-1 to High
RCREG = 0; //Empty register
}
if(Temp_Instruction == 'b')
{
LATBbits.LATB0 = 0; // RB-0 to Low
LATBbits.LATB1 = 0; // RB-1 to Low
RCREG = 0; //Empty register
}
}
}
}
Also, is there a neater way to to this?
Thanks in advance.