Topic : help with syntax - SBIT

Forum : 8051

Original Post
Post Information Post
May 16, 2012 - 6:00pm
Guest

The following is a file ioCC1110.h which is a header file copied from Texas Instruments for their CC1110 Radio/microprocessor chip which I am using to develop a signalling system for miniature railways. The processor is an 8051.
It all seems to be in order but when I assemble/compile it with Silicon Industries IDE as recommended, using Raisonance assembler,Ride7/bin/MA51 , I get the error “ C091 in line 220 of ioCC1110.h: invalid parameter declaration”. Does Raisonance apply the SBIT word in this context. I include the opening of ioCC1110.h which gives the SBIT macro define, and then line 220 to 230 which are the opening data statements for SBIT. SFR and SFRBIT seem to work OK.

#define SFR(name , addr)
#define SFRBIT(name, addr, bit7, bit6, bit5, bit4, bit3, bit2, bit1, bit0)
#define SBIT(sbit name,addr) // sbit name = addr;
#define VECT(num,addr) num
#ifdef __C51__
#define XREG(addr) ((unsigned char volatile xdata *) 0)[addr]
#elif defined __AX51__ || defined __A51__
#define XREG(addr) addr
#endif
**********************************************************************************************
/* P0 */
SBIT( P0_7 , 0x87 ) /* GPIO - Port 0, Input 7 */
SBIT( P0_6 , 0x86 ) /* GPIO - Port 0, Input 6 */
SBIT( P0_5 , 0x85 ) /* GPIO - Port 0, Input 5 */
SBIT( P0_4 , 0x84 ) /* GPIO - Port 0, Input 4 */
SBIT( P0_3 , 0x83 ) /* GPIO - Port 0, Input 3 */
SBIT( P0_2 , 0x82 ) /* GPIO - Port 0, Input 2 */
SBIT( P0_1 , 0x81 ) /* GPIO - Port 0, Input 1 */
SBIT( P0_0 , 0x80 ) /* GPIO - Port 0, Input 0 */

Can anybody help a learner, C++ seems to have so many different dialects.

Replies
Post Information Post
+1
0
-1
May 18, 2012 - 10:49am
Raisonance Support Team

Hi,

I think you have an error in your macro definition:

//#define SBIT(sbit name,addr) // sbit  name  =  addr; //WRONG!
#define SBIT(name,addr) // sbit  name  =  addr;  //Right

The Raisonance Toolchain for 8051 share the same syntax as Keil, so TI-distributed files shoul work "out of the box".

Let us know if this fixes your problem.
Best Regards

+1
0
-1
May 20, 2012 - 10:09am
Guest

Bruno-

Thanks for putting me straight. I got my books out (again) and realised that the #define just replaces SBIT with the new definition, using the parameters it is passed.

Thanks again - Jim Pinder