xxjoelxx
Joined: 28 Sep 2009 Posts: 5
|
Only first 3 bytes received from serial com1 |
Posted: Thu Nov 19, 2009 7:33 am |
|
|
I don't understand why I always get only the first 3 bytes at a time from my serial Com. I tried to use interrupt #int_RDA to see whether does it help, but to no avail. Some people met this problem too I guess. They were saying about clearing the buffer? I want to store the data received from the RS232 in an array named B2data. Below is part of my code..
Code: |
#use rs232 (baud=115200, xmit=PIN_C6, rcv=PIN_C7,ERRORS,STREAM=COM1)
#use rs232 (baud=115200, xmit=PIN_G1, rcv=PIN_G2,ERRORS,STREAM=COM2)
#use rs232 (baud=57600, xmit=PIN_E3, rcv=PIN_E4,ERRORS,STREAM=COM3) //for clk=20M max = 57600
#priority RDA,TIMER1
char B2data[8];
while(1)
{
B2data=fgetc(COM1);
if(B2data[i]=='w' || B2data[i]=='W')
{
........................
}
if(B2data[i]=='Q' || B2data[i]=='Q')
{
........................
}
}
|
|
|