I started with SDCC coupla days back for creating 8051 hex codes from C. I used " #define InBit P1^0 " and tried to assign " InBit=1 ". It throws up an error like " test.c:103: syntax error: token -> '=' ; column 5 ". I also tried to assign " P1^0=1 " directly, but still its the same error. I couldn't find much help elsewhere. What am I doing wrong? I included the " #include<8051.h> " line in my code. Byte assigning such as " P1=255 " works well.
look at the contents of the file 8051.h to see the port definitions
In your case P1_0 should have been used.
The syntax you tried looks like you are accustomed to Keil.
In this case the file compiler.h might be of interest for you. It's here:
(but also locally on your PC in the same directory where 8051.h is)
and allows to share the same header file for several compilers.
P1^0 = 1 means: P1 XOR 0 = 1 in C
Log in to post a comment.