新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 基于新唐M0的M0516LAN的SIM900A的驅(qū)動測試

基于新唐M0的M0516LAN的SIM900A的驅(qū)動測試

作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏

int SIM900A_gets(char *buf)
{
int ret=0;
int dly=3000000;// delay 3S

while(dly-->1)
{
if(UART1->FSR.RX_EMPTY == 0 )
{
*buf++ =UART1->DATA;//printf("%c",*(buf-1));
ret++;dly=10000;//delay 10ms
}
DrvSYS_Delay(1); //delay 1us
}
return ret;
}

void SIM900A_puts(const char *buf)
{
while(*buf)
{
while(UART1->FSR.TX_FULL == 1);
UART1->DATA =(*buf++)&0xff;//printf("%c",*(buf-1));
}
}

// AT+CPOWD=1 //Power down
// AT+CFUN=x //Power Saving
// AT+CBC//monitor the supply voltage
// AT+IPR=x//fixed baud rate ,“RDY” is received
// AT+CSCLK=1//enable the SLEEP mode
// AT+CMIC//adjust the input gain level of microphone
// AT+SIDET//set the side-tone level
// AT+CLVL//adjust the output gain level
// AT+CADC//read the voltage value on ADC

void SIM900A_test(void)
{
char buffer[128];

printf("");
printf("*** 9G-M0516 V1.00 Build byyuanxihua@21cn.comon ("__DATE__ " - " __TIME__ ")");
printf("*** 9G-M0516 V1.00 Rebooting ...");

SIM900A_init();

printf("SIM900A_test Send AT COMMAND @ 9600 bps !!!");

//SIM900A_puts("ATI");
SIM900A_puts("AT+GMM");
if(SIM900A_gets(buffer)>0)
{printf("%s",buffer);}
}

//源碼完畢。--縹緲九哥調(diào)試通過。

半主機(jī)的調(diào)試信息如下:

*** 9G-M0516 V1.00 Build byyuanxihua@21cn.comon (Jan 3 2012 - 13:16:32)
*** 9G-M0516 V1.00 Rebooting ...

SIM900A Open Success!!!
SIM900A_test Send AT COMMAND @ 9600 bps !!!

AT+GMM
SIMCOM_SIM900A

OK


上一頁 1 2 下一頁

評論


技術(shù)專區(qū)

關(guān)閉