erroe C141 and c202

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

Parents
  • 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;
    

Reply
  • 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;
    

Children
More questions in this forum