[an error occurred while processing this directive]
односложные ответы
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено =AK= 26 января 2005 г. 15:31
В ответ на: микроконтролле и GPRS дубль два отправлено Alexander_CH 26 января 2005 г. 15:15


int SelectPPPMode(void)
{ int i;
short int GPRSEr=1;
dputs("Initializing modem...\r\n");

// Use the hangup command to make sure the modem is on
for (i = 0 ; i < 30 ; i++)
{ dputs("ATH\r\n");
xputs("ATH\r");
if (WaitForReply("OK",1500L,1) != 0)
break;
dputs("ATH\r\n");
xputs("ATH\r");
if (WaitForReply("NO CARRIER",1500L,1) != 0)
break;
if (ringing) return 0;
}
// Enter the pin number if required
dputs("at+cpin?\r\n");
xputs("at+cpin?\r");
if (WaitForReply("READY",5000L,1) == 0)
{ if (ringing) return 0;
xputs("at+cpin=\"4106\"\r");
if (WaitForReply("OK",3000L,1) == 0)
return 0;
}
// Establiesh GPRS connection
for (i = 0 ; i < 30 ; i++)
{
if (ringing) return 0;

dputs("AT+CGATT=1\r\n");
xputs("AT+CGATT=1\r");
if (WaitForReply("OK",2000L,1) != 0)
{
dputs("OK\r\n");
GPRSEr=0;
break;
}
}
if (GPRSEr) return 0;
// Switch the modem into PPP mode
xputch('+');
Sleep(300);
xputch('+');
Sleep(300);
xputch('+');
Sleep(300);

dputs("at+cgqreq=1,0,0,0,0,0\r\n");
xputs("at+cgqreq=1,0,0,0,0,0\r");
if (WaitForReply("OK",3000L,1) == 0)
return 0;
dputs("at+cgqmin=1,0,0,0,0,0\r\n");
xputs("at+cgqmin=1,0,0,0,0,0\r");
if (WaitForReply("OK",3000L,1) == 0)
return 0;
dputs("at+cgdcont=1,\"IP\",\"Telstra.Internet\"\r\n");
xputs("at+cgdcont=1,\"IP\",\"Telstra.Internet\"\r");
if (WaitForReply("OK",3000L,1) == 0)
return 0;

dputs("atd*99#\r\n");
xputs("atd*99#\r");
if (WaitForReply("CONNECT",15000L,1) == 0)
return 0;
dputs("CONNECT\r\n");
return 1; // PPP mode should be OK
}


Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru