Hi. This is my code in Keil.
#include
#include "stdio.h"
#include "serijska.h"
#define LED P1
#sbit led1=key^0;
#sbit led2=key^1;
#sbit led3=key^2;
#sbit led4=key^3;
char slovo = 0;
unsigned char poruka[40];
int temp = 0;
void main(void){
P1=0x00;
serial_init();
while(1){
if(RI == 1){ //check interupt flag
slovo = serial_getc(); //store primljeni byte
if(slovo == '+'){
sprintf(poruka, "Temp is %d°\r\r", ++temp);
}
else if (slovo == '-') {
sprintf(poruka, "Temp is %d°\r\r", --temp);
}
else if (slovo==0x2F){
sprintf(poruka, "Temp is %d \r\r", temp);
}
else if (slovo=='1'){
led1=1;
serial_send("LED is ON and Blue\r\r");
}
else if (slovo=='2'){
led2=1;
serial_send("LED is ON and Yellow\r\r");
}
else if (slovo=='3'){
led3=1;
serial_send("LED is ON and Green\r\r");
}
else if (slovo=='4'){
led4=1;
serial_send("LED is ON and Red\r\r");
}
serial_send(poruka);
RI = 0;
}
}
}
The code is working in Keil but not in Ride7. This is error:
*** WARNING P005 IN LINE 7 OF C:\RIDE\main.c : Control 'sbit' unknown
*** WARNING P005 IN LINE 8 OF C:\RIDE\main.c : Control 'sbit' unknown
*** WARNING P005 IN LINE 9 OF C:\RIDE\main.c : Control 'sbit' unknown
*** WARNING P005 IN LINE 10 OF C:\RIDE\main.c : Control 'sbit' unknown
*** ERROR C014 IN LINE 46 OF C:\RIDE\main.c : Undefined 'led1'
*** ERROR C014 IN LINE 50 OF C:\RIDE\main.c : Undefined 'led2'
*** ERROR C014 IN LINE 54 OF C:\RIDE\main.c : Undefined 'led3'
*** ERROR C014 IN LINE 58 OF C:\RIDE\main.c : Undefined 'led4'
What is syntax for this "sbit" in Ride7??
|
#sbit isn't a RC51 syntax.
The correct way to use it is:
sbit name = sfr_name[^bit_number]
as you can see in the RC51 manual at 4.3.7 sbit
Stéphane
Thx for help I figure it out