c141 syntax error near '='

Status
Not open for further replies.

dinesh401

Advanced Member level 4
Joined
Aug 21, 2010
Messages
104
Helped
3
Reputation
4
Reaction score
2
Trophy points
1,298
Location
BANGALORE
Activity points
2,077
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.
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
 

You cannot access port pins using P0^3. I don't know your compiler but there could be pre-defined methods of accessing port bits in the include files.

Keith
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…