amish ghadiya
Newbie level 4
- Joined
- Jul 4, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 48
Hello friends..
I have learn sim900 module connect the gprs mode and get the HTTP data for any site or we can say url..
so
i try this below code in keil,But the apn was not set,so got he error,,
so how to solve ...ples Tell me..
int main (void)
{
unsigned char t=1,z;
// int j;
IO0DIR = 0xFFFFFFFF;
init_lcd();
uart0_init();
lcd_clear();
delay(100000);
while(z)
{
i=0;
t=1;
while(t)
{
if(i==9)
{
i=0;
}
uart0_puts("AT\r");
while(i<9);
delay(1000);
if(a[5] == 'O' && a[6] == 'K')
{
lcd_clear();
lcd_putstring(0,"GSM Init OK");
t=0;
}
else
{
lcd_clear();
lcd_putstring(0,"GSM Init Error");
delay(10000);
i=0;
delay(1000);
}
t=0;
}
delay(10000);
i=0;
t=1;
while(t)
{
if(i==16)
{
i=0;
}
uart0_puts("AT+CGATT=1\r");
while(i<16);
lcd_clear();
delay(100000);
if(a[13] == 'O' && a[14] == 'K')
{
lcd_clear();
lcd_putstring(0,"GPRS ACTIVE");
t=0;
//i=0;
}
else
{
lcd_clear();
lcd_putstring(0,"GPRS FAILED");
delay(10000);
i=0;
//delay(100000);
t=0;
}
}
delay(10000);
t=1;
i=0;
while(t)
{
if(i==25)
{
i=0;
}
delay(100000);
uart0_puts("AT+CSTT=\"www\"\r");
while(i<25);
delay(100000);
lcd_clear();
lcd_putchar(a[0]);lcd_putchar(a[1]);lcd_putchar(a[2]);lcd_putchar(a[3]);lcd_putchar(a[4]);lcd_putchar(a[5]);
lcd_putchar(a[6]);lcd_putchar(a[7]);lcd_putchar(a[8]);lcd_putchar(a[9]);lcd_putchar(a[10]);lcd_putchar(a[11]);
lcd_putchar(a[12]);lcd_putchar(a[13]);lcd_putchar(a[14]);lcd_putchar(a[15]);
lcd_gotoxy(1,0);
lcd_putchar(a[16]); lcd_putchar(a[17]);
lcd_putchar(a[18]); lcd_putchar(a[19]); lcd_putchar(a[20]); lcd_putchar(a[21]); lcd_putchar(a[22]); lcd_putchar(a[23]);
lcd_putchar(a[24]);
// t=0;
}
}
}
I have learn sim900 module connect the gprs mode and get the HTTP data for any site or we can say url..
so
i try this below code in keil,But the apn was not set,so got he error,,
so how to solve ...ples Tell me..
int main (void)
{
unsigned char t=1,z;
// int j;
IO0DIR = 0xFFFFFFFF;
init_lcd();
uart0_init();
lcd_clear();
delay(100000);
while(z)
{
i=0;
t=1;
while(t)
{
if(i==9)
{
i=0;
}
uart0_puts("AT\r");
while(i<9);
delay(1000);
if(a[5] == 'O' && a[6] == 'K')
{
lcd_clear();
lcd_putstring(0,"GSM Init OK");
t=0;
}
else
{
lcd_clear();
lcd_putstring(0,"GSM Init Error");
delay(10000);
i=0;
delay(1000);
}
t=0;
}
delay(10000);
i=0;
t=1;
while(t)
{
if(i==16)
{
i=0;
}
uart0_puts("AT+CGATT=1\r");
while(i<16);
lcd_clear();
delay(100000);
if(a[13] == 'O' && a[14] == 'K')
{
lcd_clear();
lcd_putstring(0,"GPRS ACTIVE");
t=0;
//i=0;
}
else
{
lcd_clear();
lcd_putstring(0,"GPRS FAILED");
delay(10000);
i=0;
//delay(100000);
t=0;
}
}
delay(10000);
t=1;
i=0;
while(t)
{
if(i==25)
{
i=0;
}
delay(100000);
uart0_puts("AT+CSTT=\"www\"\r");
while(i<25);
delay(100000);
lcd_clear();
lcd_putchar(a[0]);lcd_putchar(a[1]);lcd_putchar(a[2]);lcd_putchar(a[3]);lcd_putchar(a[4]);lcd_putchar(a[5]);
lcd_putchar(a[6]);lcd_putchar(a[7]);lcd_putchar(a[8]);lcd_putchar(a[9]);lcd_putchar(a[10]);lcd_putchar(a[11]);
lcd_putchar(a[12]);lcd_putchar(a[13]);lcd_putchar(a[14]);lcd_putchar(a[15]);
lcd_gotoxy(1,0);
lcd_putchar(a[16]); lcd_putchar(a[17]);
lcd_putchar(a[18]); lcd_putchar(a[19]); lcd_putchar(a[20]); lcd_putchar(a[21]); lcd_putchar(a[22]); lcd_putchar(a[23]);
lcd_putchar(a[24]);
// t=0;
}
}
}