Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

need help for gsm programming!!!

Status
Not open for further replies.

desmondlai

New Member
the 1st do while loop is working properly but the program run till receive the data from modem ofprintf("at+cgmm\r"); then the program stops working ....

any solution on it?

#include <htc.h>
#include <stdio.h>
#include "usart.h"
#include "delay.h"
#include <string.h>

int main(void)
{
//Initialize PORTD
//PD0 as Output
TRISB=0b00000000;
TRISC=0b10000000;
INTCON=0; // purpose of disabling the interrupts.
init_comms(); // set up the USART - settings defined in usart.h

char input[80],i;




PORTB =0B11111111; //PORTB0 = HIGH
DelayMs(1000);
PORTB =0B00000000; //PORTB0 = LOW
DelayMs(500);
while(1)
{
printf("at\r");
do
{
gets(input);
i=strstr(input,"OK"); // Find OK from input
} while(i!=input);
RB0=1;
DelayMs(1000);
RB0=0;
DelayMs(500);
printf("at+cgmm\r");
do
{
gets(input);
i=strstr(input,"OK"); // Find OK from input
} while(i!=input);
RB1=1;
DelayMs(1000);
RB1=0;
DelayMs(500);





}

}
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top