dinesh401
Advanced Member level 4
i am writing a simple code which uses serial communication, in which when a character is sent it performs some action. but can't understand one error. Below is my code.
but i got the error c141: syntax error near ' = '
at every line of port pin, it was coming in the isr function.
can u tell me the reason. thankyou
Code:
#include<reg52.h>
void dinnu(void) interrupt 4
{
unsigned char dat;
dat=SBUF;
while(RI==0)
RI=0;
SBUF=dat;
while(TI==0);
TI=0;
if(dat==1)
{
P0^0 = 1;P0^1 = 0;P0^2 = 0;
}
if(dat==2)
{
P0^3=1;P0^4=0;P0^5=0;
}
if(dat==3)
{
P0^6=1;P0^7=0;P1^0=0;
}
if(dat==4)
{
P1^1=1;P1^2;P1^3=0;
}
if(dat==5)
{
P1^4=1;P1^5=0;P1^6=0;
}
if(dat==6)
{
P1^7=1;P2^0=0;P2^1=0;
}
}
void main(void)
{
TMOD = 0X20;
TH1=0xFD;
SCON=0X50;
TR1=1;
RI=0;
ES=1;
EA=1;
P0=0x00;
P1=0x00;
P2=0x00;
while(1)
{;}
}
but i got the error c141: syntax error near ' = '
at every line of port pin, it was coming in the isr function.
can u tell me the reason. thankyou