The following source code was meant for sending message from a gsm module. But I'm not getting how to send it to a particular directory number. It's as follows:
#include<mega16.h> #include<delay.h> #include"lib/sim300/sim300.h" void send message(char msg[],char num[]); { int i=0,j=0; puts("AT+CMGF="); putchar(49); //sends the ASCII value of '1'// puts("AT+CMGS="); putchar("\"); while(num[i]!='\0') { j=(int)num[i]; putchar(j); //sends the ASCII values of directory number 0123456789// i++; } puts("Hello there"); putchar('26'); //sends the ASCII value of <CTRL>+<Z> }
#include<mega16.h>
Is this really related to Keil???
puts() in most contexts will add an extraneous '\n' into the stream, I'd be surprised if the modem appreciates that.
Code seems inattentive to if the modem responds, with OK or ERROR or whatever. Blind sending AT commands will usually end in failure at some point.
Suggest you read the manual for the modem, and review C references.
Please review the posting instructions before pasting in source code.