We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
can any one solve this #include <AT89X51.H>
#include<stdio.h> bdata unsigned int a;
sbit lsb=a^0; sbit msb=a^7; bit i; void main() { a=0xaa; while(1) { i=lsb; a=a>>1; msb=i; a^7=msb; P1=a; } }
for this code iam getting error as syntax error near"="
nice formatting mate
you have synta error near"="
what line does the comp say?
That is usually a very important question. In this case, the answer is fairly trivial, though:
a^7=msb;
This is not valid syntax. "^" can only specify bits within an sbit declaration. In any other expression, it is regarded as an XOR operator.
The line
is incorrect. You can't use the '^' for bit operations - it represents an xor operation, and hence a^7 is not an lvalue, i.e. something you can assign to.
The overloaded meaning of '^' can only be used when declaring bit variables.
Too slow again :)