Hello,
i am facing problems understanding the following C code for microcontroller. Actually the task is to configure an external GSM modem via serial microcontroller port but i am not able to get the coding exactly. can someone please help me understand it. also it would be nice if some one can give me the assemble code for same.
i am facing problems understanding the following C code for microcontroller. Actually the task is to configure an external GSM modem via serial microcontroller port but i am not able to get the coding exactly. can someone please help me understand it. also it would be nice if some one can give me the assemble code for same.
Rich (BB code):
void gsmcmdsend(unsigned char *cmd);
unsigned char gsm_cmd3[]="AT&W";
unsigned char gsm_cmd4[]="AT+CMGF";
void gsmcmdsend(unsigned char *cmd)
{
unsigned char i;
for(i=0;*cmd!='\0';i++)
{
SBUF=*cmd;
while(TI==0);
TI=0;
cmd++;
}
SBUF=0x0A;
while(TI==0);
TI=0;
SBUF=0x0D;
while(TI==0);
TI=0;
while(RI==0);
RI=0;
}
void main()
{
gsmcmdsend(gsm_cmd3);
gsmcmdsend(gsm_cmd4);
}
Last edited by a moderator: