kauboy
2008-07-12
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.
Frieder Ferlemann
2008-07-12
look at the contents of the file 8051.h to see the port definitions
(sdcc/include/mcs51/8051.h).
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:
http://sdcc.svn.sourceforge.net/viewvc/sdcc/trunk/sdcc/device/include/mcs51/compiler.h?view=markup
(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.
Maarten Brock
2008-07-18
P1^0 = 1 means: P1 XOR 0 = 1 in C