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.
please help me to solve the error my program is shown below
// Bootloader and Library Fnctions Starts Here // #include<AT89X52.h> void setup(); void loop(); void main(){ setup(); while(1)loop(); } // Bootloader and Library Fnctions Ends Here // #define IR_PIN P3^0 void delayRC5(unsigned char p); void processIR(unsigned char command); __bit flipBit = 0; __bit prevFlipBit = 0;
void setup(){
} void loop(){ unsigned char address = 0x00; unsigned char command = 0x00; unsigned char count=0x00; while(IR_PIN==1); //Wait for first bit delayRC5(7); //Delay for 3.024ms flipBit=IR_PIN; //Reading flip bit for(count=0;count<5;count++){ delayRC5(4); //Delay for 1.728ms address = address << 1; if(IR_PIN==1) address = address | 0x01; } for(count=0;count<6;count++){ delayRC5(4); //Delay for 1.728ms command = command << 1; if(IR_PIN==1) command = command | 0x01; } //P1 = command; if(address == 0x00 && flipBit != prevFlipBit){ processIR(command); prevFlipBit = flipBit; } } void processIR(unsigned char command){ if(command == 0x01){ P1^1 = ! P1^1; P2^1 = ! P2^1; }else if(command == 0x02){ P1^2 = ! P1^2; P2^2 = ! P2^2; }else if(command == 0x03){ P1^3 = ! P1^3; P2^3 = ! P2^3; }else if(command == 0x04){ P1^4 = ! P1^4; P2^4 = ! P2^4; }else if(command == 0x05){ P1^5 = ! P1^5; P2^5 = ! P2^5; }else if(command == 0x06){ P1^6 = ! P1^6; P2^6 = ! P2^6; }else if(command == 0x07){ P1^7 = ! P1^7; P2^7 = ! P2^7; } } //delay for 432uS. For 3.024ms call 7 times and fro 1.728ms call 4 times // void delayRC5(unsigned char r){ unsigned char p; unsigned int q; for(p=0;p<r;p++) for(q=0;q<53;q++); //Clock 11.0592MHz }
www.danlhenry.com/.../keil_code.png