Projects › Projects › PIC32 to M95 GSM interface › PIC32 to M95 GSM interface
April 1, 2016 at 11:16 am
#13840
nilesh
Participant
Hi,
Which PIC32 you are using?In general GSM module work on AT commands.For the interfacing of the GSM and PIC microcontroller you need to write UART receive Interrupt code.
sample here
void UART1Handler (void) __irq
{
char TEMP = 0;
TEMP = U1IIR;
if(TEMP & 0x04)
{
while(U1LSR & 0x01)
{
TEMP = U1RBR;
Buffer[Count] = TEMP;
Count++;
if ( Count >= BUFSIZE ) Count = 0;
}
}
MSSG[6] = MSSG[5];
MSSG[5] = MSSG[4];
MSSG[4] =MSSG[3];
MSSG[3] = MSSG[2];
MSSG[2] = MSSG[1];
MSSG[1] = MSSG[0];
MSSG[0] = TEMP;
if(TEMP == '>')GTR = 1;
if((MSSG[1] == 'O') && (MSSG[0] == 'K')) I_OK = 1;
if((MSSG[1] == 'I') && (MSSG[0] == 'P')) I_IP = 1;
if((MSSG[4] == 'E') && (MSSG[3] == 'R')&& (MSSG[2] == 'R')&& (MSSG[1] == 'O')&& (MSSG[0] == 'R')) ERR = 1;
if((MSSG[6] == 'C') && (MSSG[5] == 'O')&& (MSSG[4] == 'N')&& (MSSG[3] == 'N')&& (MSSG[2] == 'E')&& (MSSG[1] == 'C')&& (MSSG[0] == 'T')) CNT = 1;
if((MSSG[5] == '2')&& (MSSG[4] == '0')&& (MSSG[3] == '0')&& (MSSG[2] == ' ')&& (MSSG[1] == 'O')&& (MSSG[0] == 'K')) S_200 = 1;
if((MSSG[5] == 'W')&& (MSSG[4] == '!')&& (MSSG[3] == 'B')&& (MSSG[2] == '@')&& (MSSG[1] == 'E')&& (MSSG[0] == '#')) flag = 1;
if((MSSG[5] == 'A')&& (MSSG[4] == 'R')&& (MSSG[3] == 'R')&& (MSSG[2] == 'I')&& (MSSG[1] == 'E')&& (MSSG[0] == 'R')) NCRR = 1;
if((MSSG[3] == 'R')&& (MSSG[2] == 'I')&& (MSSG[1] == 'N')&& (MSSG[0] == 'G')) Ring = 1;
if((MSSG[3] == '+')&& (MSSG[2] == 'C')&& (MSSG[1] == 'M')&& (MSSG[0] == 'T'))
{
smsrcv = 1;
Count = 0;
}
VICVectAddr = 0;
}