hello
i can not get the text message receive on my cell phone or any other network via the program coding below.
it simply desinged so that to send sms only .... not receive
i can get all other command resposnes back from the gsm modem and display on my LCD....so i know that the hardware is working correctly and that my below code snippet is wrong somewhere.
plz can someone look at my code below and tell me what is wrong and why i can not receive text mesage on my cell phone.
my setup involves the following...
PIC18F4220 @ 20MHz C18
MAX202CPE
GSM Modem Siemens Model TC35
thank you
haseeb
i can not get the text message receive on my cell phone or any other network via the program coding below.
it simply desinged so that to send sms only .... not receive
i can get all other command resposnes back from the gsm modem and display on my LCD....so i know that the hardware is working correctly and that my below code snippet is wrong somewhere.
plz can someone look at my code below and tell me what is wrong and why i can not receive text mesage on my cell phone.
my setup involves the following...
PIC18F4220 @ 20MHz C18
MAX202CPE
GSM Modem Siemens Model TC35
thank you
haseeb
Code:
void main(void)
{
putUSARTcustom( "AT+CMGF=" ); //write the 'SMS Format Selection' AT command syntax
TXREG = 1; //SMS format in TEXT mode
while(TXSTAbits.TRMT==0); //wait until transmition is complete
TXREG = 0x0D; //write CR
while(TXSTAbits.TRMT==0); //wait until transmition is complete
while(1) //loop for 'OK' reply from modem
{
while(PIR1bits.RCIF == 0); //wait for data reply from GSM Modem
GSM_Byte_1 = RCREG; //reading RCREG clears RCIF
while(PIR1bits.RCIF == 0); //wait for data reply from GSM Modem
GSM_Byte_2 = RCREG; //reading RCREG clears RCIF
if(GSM_Byte_1 == 'O' && GSM_Byte_2 == 'K') //break from while loop when u get 'OK'
break;
}
putUSARTcustom( "AT+CMGS=xxxxxxxxxxx" ); //enter in the desired number to send SMS via AT command
TXREG = 0x0D; //write CR
while(TXSTAbits.TRMT==0); //wait until transmition is complete
while(1) //loop for '>' reply from modem
{
while(PIR1bits.RCIF == 0); //wait for data reply from GSM Modem
GSM_Byte_1 = RCREG; //reading RCREG clears RCIF
if(GSM_Byte_1 == '>') //break from while loop when u get '>'
break;
}
putUSARTcustom( "PIC" ); //enter desird text to be sent
TXREG = 0x1B; //write ESC to finish sending text message
while(TXSTAbits.TRMT==0); //wait until transmition is complete
TXREG = 0x0D; //write CR
while(TXSTAbits.TRMT==0); //wait until transmition is complete
while(1); //end program
}//end of main()
void putUSARTcustom(const rom char *data)
{
char c;
while ((c = *data++))
{
TXREG = c; //Transmit a byte
while(TXSTAbits.TRMT==0); //wait until transmition is complete
}
} //end of putUSARTcustom()