my program is this:
#include <REGX51.h> #include <math.h>
#define s_pin P2^0; #define w_sensor P2^7; #define red_led P3^0; #define yellow_led P3^1; #define buzr P1^0;
main() { while(1) { if(s_pin==0 & w_sensor==1) { SET yellow_led; CLR red_led; } else if(switch_pin==1) { SET red_led; CLR yellow_led; SET buzr; }
} }
and error are these:
Build target 'Target 1' compiling ff.c... FF.C(14): error C141: syntax error near ';' FF.C(14): error C141: syntax error near '==' FF.C(14): error C141: syntax error near '==' FF.C(14): error C141: syntax error near ')' FF.C(16): error C202: 'SET': undefined identifier FF.C(17): error C202: 'CLR': undefined identifier FF.C(17): error C141: syntax error near 'P3' FF.C(19): error C141: syntax error near 'else' FF.C(19): error C202: 'switch_pin': undefined identifier FF.C(21): error C202: 'SET': undefined identifier FF.C(21): error C141: syntax error near 'P3' FF.C(22): error C202: 'CLR': undefined identifier FF.C(22): error C141: syntax error near 'P3' FF.C(23): error C202: 'SET': undefined identifier FF.C(23): error C141: syntax error near 'P1' Target not created
You are the person who have a C code containing SET and CLR. You should then know why you would use such words in your code. Why don't you tell us why you decided to use SET and CLR?
More convetional developers would often create
#define ON 0 // Assuming LED connected VCC and port pin, so low pin turns on the LED. #define OFF 1 ... my_led = ON;
Thanks a lot brother... I am new to it... and i was so much confused in it..thanks a lot.. All the C202 error are gone..
now i am left with these.....:
Build target 'Target 1' compiling ff.c... FF.C(16): error C141: syntax error near ';' FF.C(16): error C141: syntax error near '==' FF.C(16): error C141: syntax error near '==' FF.C(16): error C141: syntax error near ')' FF.C(18): error C141: syntax error near '=' FF.C(19): error C141: syntax error near '=' FF.C(21): error C141: syntax error near 'else' FF.C(21): error C141: syntax error near ';' FF.C(21): error C141: syntax error near '==' FF.C(21): error C141: syntax error near ')' FF.C(23): error C141: syntax error near '=' FF.C(24): error C141: syntax error near '=' FF.C(25): error C141: syntax error near '=' Target not created
So have you looked at line 16 - or the non-empty line immediately before line 16 - and checked if it fulfills the C syntax rules?
Bro, I told u earlier also... i am new on this... i have checked the line...its fine.. and i dnt know much about that... if you could provide me the running program....plz
View all questions in Keil forum