lifiq
Junior Member level 2

this is my code below that i am using with pic18f452 pic....im using wavecom gsm modem through max232 ic.....but i do not know why it doesnt work....i simulate it using proteus and it works the only thing is when i set in my code baudrate of 19200 the the virtual terminal baudrate is set to 9600 to see the at command pop up at the virtual terminal....pls help me guys.

#define intruder PORTB.f7
#define button_ON PORTB.f6
#define blockcar PORTD.f7
char j[10] = "AT+CMSS=1"; // COMMAND SEND MESSAGE FROM
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(19200); // 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;
if(button_ON==0)
{
goto ON;
}
else if (button_ON==1)
{
goto INTRUDER;
}
}
INTRUDER:
while(1)
{ if((button_ON==1)&&(intruder==1))
{
blockcar=1;
goto SSMS;
}
}
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
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(19200); // 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;
if(button_ON==0)
{
goto ON;
}
else if (button_ON==1)
{
goto INTRUDER;
}
}
INTRUDER:
while(1)
{ if((button_ON==1)&&(intruder==1))
{
blockcar=1;
goto SSMS;
}
}
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
}
}
}
}