bluelake
Newbie level 2
read 2 character pic16f877 serial interrupt
Hi,
I'm working with a pic16f877. I can't figure out how to read 2 characters (2 byte + 2 byte) from serial with no delay between them.
I'm using serial interrupt here a piece of code:
What I want to do is use serial interrupt and save the first character in CMD and the second one in CHK, But if I run the program, CMD always get the last character of the 2 characters.
I hope you can see my problem and tell me if there is some way to read all 2 characters and save them in CMD and CHK.
thank you
Hi,
I'm working with a pic16f877. I can't figure out how to read 2 characters (2 byte + 2 byte) from serial with no delay between them.
I'm using serial interrupt here a piece of code:
Code:
void interrupt ISR{
if(RCIF) byte1 = RCREG;
}
main
{
while(1){
CMD = byte1;
CHK = byte2;
}
}
What I want to do is use serial interrupt and save the first character in CMD and the second one in CHK, But if I run the program, CMD always get the last character of the 2 characters.
I hope you can see my problem and tell me if there is some way to read all 2 characters and save them in CMD and CHK.
thank you