This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sbit error

Hello everyone

I tried to write a C code using uvision but at the very beginning I got a problem with my declaration.

I want to use sbit to address a single bit.

My problem is that uvision won't accept my code and marks it red.
I couldn't find anything to fix this problem.

I am not sure if I missed any lines or forgot include files.
Would be great if someone could give me a hint to fix that.

Also the Build Output window shows errors:
error C146: 'P1_0': invalid base address
error C202: 'led': undefined identifier

My code is really simple at the moment but this shouldn't be the problem.


#include<REGX51.h>

sbit led = P1_0;

void main(void){

while(1){

led=1;

led=0; }
}

REGX51.h
/*------------------------------------------------
P1 Bit Registers
------------------------------------------------*/
sbit P1_0 = 0x90;
sbit P1_1 = 0x91;
sbit P1_2 = 0x92;
sbit P1_3 = 0x93;
sbit P1_4 = 0x94;
sbit P1_5 = 0x95;
sbit P1_6 = 0x96;
sbit P1_7 = 0x97;

Thanks
Alex