lifiq
Junior Member level 2
![Junior Member level 2](/styles/images/ranks/clevel2.gif)
i have a code here in mikro c but can anyone pls help me to convert it into c code so that it can be compiled and be used in the mplab software......im doing a project on a car alarm system using pic16f877a mcu....pls guys
#define intruder PORTB.f7
#define button_ON PORTB.f6
#define blockcar PORTD.f7
char j[10] = "AT+CMSS=1"; // COMMAND SEND MESSAGE FROM STORAGE TO PHONE
int enter = 0X0D; // COMMAND FOR ENTER
char i;
void main()
{
trisb = 0xff; // SET PORTB AS INPUT
portd = 0x00; // SET INITIAL VALUE FOR PORTD
trisd = 0x00; // SET PORTD AS OUTPUT
UART1_Init(9600); // SYNCHRONIZE BAUDRATE WITH HANDPHONE
trisc.f7 = 1; // SET Rx DATA IN
trisc.f6 = 0; // SET Tx DATA OUT
while(1)
{
ON:
while(1)
{
blockcar=0; // SET INITIAL FOR NOT BLOCKING CAR
if(button_ON==1) // ON OR NOT THE SYSTEM
{
if(button_ON==0)
{
goto ON;
}
else if
(intruder==0) // FIND OUT IF THE DOOR STILL OPEN OR NOT
{
goto INTRUDER; // GO TO CHECK FOR AN INTRUDER
}
}
}
INTRUDER:
while(1)
{
if(button_ON==0)
{
goto ON;
}
else if((intruder==1)&&(button_ON==1)) // CHECK IF THERE IS AN
{
goto SSMS; // GO TO SENDS SMS AFTER
}
}
SSMS:
while(1)
{
for(i=0;i<10;i++)
UART1_Write(j); // SENDING CHARACTER FOR SENDS SMS
UART1_Write(enter);
goto USERINT; // GO TO BLOCKING CAR
}
USERINT:
while (1)
{
blockcar=1; // BLOCKING THE CAR
if (button_ON==0) // WAIT FOR USER INTERRUPT
{
goto ON; // BACK TO START AFTER USER INTERRUPT
}
}
}
}
#define intruder PORTB.f7
#define button_ON PORTB.f6
#define blockcar PORTD.f7
char j[10] = "AT+CMSS=1"; // COMMAND SEND MESSAGE FROM STORAGE TO PHONE
int enter = 0X0D; // COMMAND FOR ENTER
char i;
void main()
{
trisb = 0xff; // SET PORTB AS INPUT
portd = 0x00; // SET INITIAL VALUE FOR PORTD
trisd = 0x00; // SET PORTD AS OUTPUT
UART1_Init(9600); // SYNCHRONIZE BAUDRATE WITH HANDPHONE
trisc.f7 = 1; // SET Rx DATA IN
trisc.f6 = 0; // SET Tx DATA OUT
while(1)
{
ON:
while(1)
{
blockcar=0; // SET INITIAL FOR NOT BLOCKING CAR
if(button_ON==1) // ON OR NOT THE SYSTEM
{
if(button_ON==0)
{
goto ON;
}
else if
(intruder==0) // FIND OUT IF THE DOOR STILL OPEN OR NOT
{
goto INTRUDER; // GO TO CHECK FOR AN INTRUDER
}
}
}
INTRUDER:
while(1)
{
if(button_ON==0)
{
goto ON;
}
else if((intruder==1)&&(button_ON==1)) // CHECK IF THERE IS AN
{
goto SSMS; // GO TO SENDS SMS AFTER
}
}
SSMS:
while(1)
{
for(i=0;i<10;i++)
UART1_Write(j); // SENDING CHARACTER FOR SENDS SMS
UART1_Write(enter);
goto USERINT; // GO TO BLOCKING CAR
}
USERINT:
while (1)
{
blockcar=1; // BLOCKING THE CAR
if (button_ON==0) // WAIT FOR USER INTERRUPT
{
goto ON; // BACK TO START AFTER USER INTERRUPT
}
}
}
}