shinigami.alv
Newbie level 4
for some reasons, my code isnt running as how it is suppose to run. can help me to figure out where is the problem? the program suppose to run like this: my PIC receives data from another PIC and pin Dx will become high if the corresponding correct bit received. and if RC2 is not low, port D will be cleared and become low. however, the pin Ds wont be all high even if i received all 4 correct bits. and also, when i put RC2 to high, it wont jump out from the while loop unless it receives another bit.
PHP:
while(1)
{
if (OERR==0)
{
CREN=1;
while (RC2==0)
{
no=read_packet();
if (no==0b00001010)
{
RD2 = 1;
}
else if (no==0b00001001)
{
RD3 = 1;
}
else if (no==0b00000110)
{
RD4 = 1;
}
else if (no==0b00001111)
{
RD5 = 1;
}
else
{
RD2 = RD2;
RD3 = RD3;
RD4 = RD4;
RD5 = RD5;
}
}
RD2 = 0;
RD3 = 0;
RD4 = 0;
RD5 = 0;
}
else CREN=0; //if overrun error, disable continuous receive
}