hi there, i need a a smal help,
i made a circuit for interfacing my mobile with the microcontroller to send message through the mobile, by using serial port.
i need to write code for that.
if i need to write code in c language for transmiting some data from a register of microcontroller AT89c51, how should i procede,
i mean any one can help me regarding a sample code to do that.
thanks.
i cannot understand the code completely ...if possible plz explain a little ,,, specially,
#include sbit led=P1^0;
while(*a!='\0')
ok[j]=rcv();
if(ok[0]=='O'&&ok[1]=='K')
led=1;
can u modify the code for t610... and also mention where we are giving the phone number of the person whom we want to send the message...
thanks in advance.
thanks for replying...other commandds are ok, but i m a little confused in,
while(*a!='\0')
from where the microcontroller will read the character,,,
is this character given by the user...
if we want microcontrolller to read the numbers from any location of memory or from some register what will be the command.
and what the following command wil do
transmit("AT");
and the last thing from where we will give the mobile number of the person whoom we wanna transmit the message if the mobile is attached with microcontroller
hi itsfanidotcom:!:
as i said u that u can modify it as u need. have u succeeded in sending message from hyper terminal:?: if so then u can easily do that in this code.
for example i u want to delete a message from your mobile
for t29s the commands are
AT+CMGD=1 // command to delete the message which i have at first
//mermory location
OK // with this output the mesasge in my mobile at first location
// will be deleted
so in code u can do it as
transmit("AT+CMGD=1");
transmit(0x0d);
for(j=0;j<2;j++)
ok[j]=rcv();
if(ok[0]=='O'&&ok[1]=='K')
led=1; // if led glows then u have successfully deleted message from your mobile.
first u visit **broken link removed**
and understand how to send sms. and if u got it then try to write code for it or if u face any problem then show it in the forum we will try to solve it!!
thanks for ur reply,,,
yes i have transmitted the message successfuly through hyper terminal...and now i wanna implement the AT Commands through programing.
i have msged u in ur inbox... and i explained in detail.. i have a little concept of programing of AT commands. i have checked the site but it explains the concept of PDU mode...and i want to send message in text mode.
but first pl tell me whether i have to make the functions:
transmit();
rcv();
by my self or they are built in in the compiler....
and also plz specify if wanna send the message through some memory location then how should i write this in AT+CMGW,,, as in hyper terminal we got a '>' sign , how will we write this in C.
thanks again for reply.
hi itsfanidotcom,
here is solution for ur problem..
here is program for 8051 in c for sending message also it is checked on proteus and working fine.
hope it will help u..
hi abbas,
i m not able to compile the code which u gave.
i have C51 compiler and i m compiling the code, and want to generate the HEX file, but i m getting the following errors:
can u tel me what could be the problem
i m also attaching the code.if possible plz tel the problem ...
thanks for ur cooperation.(the code is in .doc extension change it to .c, the path of the included .h file is same as shown in the program)
hi abbas,
thaks for ur help,
the code u send after removing the error is now successfully compiled and .HEX file is generated.
but the problemis that when i try to run the hex file in proteus, i m able to see only OK in terminal screen, nothing after that, i think there is some problem with checkOK() function, because in the third line in the main function ofter sending the carriage return OxOD(i have used capital 'D'and smal 'd' both but nothing changes), the checkOK() function is not responding OK. first tel me in ur program u wrote 0X0d is it right or we use 0X0D for carriage return.
plz help me in this regard so that i m able to run it on the actual circuit....
thanks. i m also attaching the responce plz check...
thaks again for ur cooperation ...i know it takes ur time...
yaaaaar
hyperterminal acts as ur mobile.
1. controller send AT commnd with carriage return to ur cell (hyper terminal here)
2.cell has to reply OK(u will type OK in hyper terminal)
3.this OK is checked by checkOK() method and if OK received then
4.controller send AT+CMGF=1 + carriage return to ur cell
5.again ur cell must reply OK(u have to type OK again in terminal)
6.checkOK() will check this OK again and if it is received then
7.controller send command AT+CMGS="mobile number here" +carriage return to cell
8.mobile phone will send back a prompt formed by four characters. They are the carriage return character, the linefeed character, the ">" character and the space character
So, here is what you will actually see in a terminal program such as Hyper Terminal:
AT+CMGS="mobile num here"
>
but i have simplified it
because the controller have to send the message string when it gets space character so when u will type space on terminal in proteus controller will send the message string
and if it was a cell phone (not terminal) the message will be sent to the number u specified
dats the alogo behind program
i hope u will understand it and wil do according to the steps i explained above
ohhhhh thaks buddy... i was expecting that the terminal program will respond the ok and other responses by it self...
well i have again run that in proteus and it is working fine.
but first tel me that i m not able to see the ok and the > sign ...but in the images u send earlier , there ok can be seen... is there any setting required for this..
hi abbas, i send a message to u.. plz read it...
secondly i need to know that which pins of the DB9,,,which is attached to max232,,,, should be made short and which pins should be used as Tx and Rx when the DB9 connector is attached to t630 mobile... thanks