Hello.. I am doing one project in which msg from GSM is read and it is Displayed to LCD. but microcontroller 89v51 and GSM900A does not communicate every time.. sometimes it successfully happen that AT command from microcontroller is send to GSM and message from any no. to GSM is Displayed to LCD.. bt it's not happening everytime.. i am not getting the solution, Please help.. I have connect 12V,2A supply to GSM.. Microcontroller Rx pin connected to Tx of GSM.. Microcontroller Tx pin Connected to Rx of GSM.. and Ground to Ground.. Please help me. what may be the problem? and how should i fix that.
Sounds like a software issue.
You need to wait and respond appropriately to the AT commands. If they indicate it is in the process of reading the SIM, or connecting to the network, you need to wait and retry as appropriate, rather that jamming AT commands and delaying arbitrarily.
Thanks Westonsupermare Pier.. bt i didn't get the issue.. My code works fine in proteus software.. bt in actual hardware there is problem of communication .. I have given delay after sending one AT command and i m also waiting for respone.. I have given 1sec delay . Should i give more delay?? and as u say how can i monitor the indication of reading process is going on???
Why?
If you're waiting for the response, then a delay is pointless - possibly even detrimental.
eg, what happens if the response comes during your delay ... ?
What he actually said was:
If [the responses from the module] indicate it is in the process of reading the SIM, or connecting to the network ..."
So you need to be reading the responses from the module, and acting accordingly.
The possible responses that the module might provide will be detailed in its documentation
SORRY.. i have send the AT command then i am waiting for respone. and my code is working fine in proteus software
i am reading the response in microcontroller bt i didn't display it to LCD so i don't know what response is getting... should i display it to LCD to know that GSM is giving correct response or not???? and if after doing so there is no correct or desires response then what should i do???
i am sending AT commands. and waiting for response.. sequence AT\r\n monitoring response ATEO\r\n monitoring response AT&W\r\n monitoring response AT+CMGF=1\r\n monitoring response AT+CNMI=2,2,0,0,0\r\n monitoring response displaying on LCD "COMMAND SEND" then as soon as msg will come it will display to LCD..
bt in actual LCD does not display COMMAND SEND. and msg can not be read.. and some time it display COMMAND SEND and msg is also displayed to LCD bt after this if i send another msg it does not displayed on LCD.. . connection is correct.. 12v ,2A supply is also given .. network is also available Sim.. then what is the problem??
Well, you need to understand what is actually happening in your systems.
If displaying stuff on an LCD works for you - then do it.
Other alternatives could be send stuff out of a serial port.
Or blink some LEDs
Or use a modern chip with on-board debug.
Maybe monitor the exchanges between the MCU and modem; eg, see "Debugging Serial Comms" here: www.avrfreaks.net/.../2416751
Or a combination of the above.
Debugging is a key skill in any form of development - hardware, software, whatever: www.avrfreaks.net/.../2418156
So basically not checking the registration state on the network, or if the modem has reached a point where sending/receiving SMS is viable.
Assume Proteus is a poor reflection of reality, if you want your system to work in the real world you're going to have to observe what is actually happening rather that walk through a script that shows no depth of understanding.
What does AT+CREG? report?
Thank you so much Andrew Neil.. I will try all the possible things you maintained... Hope it will definitely solve my problem . if i am having problem again i will again contact you.. thanks again for your guidance..
In putty software AT+CREG? +CREG: 0,1
OK it is the response
Ok, that's great but what does the interaction log look like when you automate that on the 89V51, and the SMS fails to send?
sorry for late reply. i can not read the response from microcontroller... or i have written the program to read data from RX pin .. and display it to LCD. and i am using that program to read response of gsm.. bt in proteus it itdisplys nothing on lcd .. .. another try.. i wrote program in that after sending every AT commnad and reading the respone i m displaying on LCD that "AT+*** send".. and i join lcd between the tx and rx wires i.e microcontroller RX -LED- GSM TX and Microcontroller Tx -LED- GSM Rx to know that are signals is passing between them.. then also no command send.. to check the LED is wroking or not i set my multimeter in continoty mode and cheak the LCD between Microcontroller Rx-LED- GSM Tx .. LCD glows.. as soon as i glows led twice LCD displays "AT+** send". and after 2nd time i glow led twice LCD displays about 2nd command"AT+** send" after giving this type of pulses every command send one by one.. then also msg is not read..
what may be problem???
Sounds like you need to pick a system that's easier to debug or instrument.
Perhaps you should start by coding your application/automation so it runs on a PC via the COM port, so your app talks in place of Putty/Terminal.
This way C code running on the PC can using printf, files, time, etc to debug and better understand the interaction. Unless you can program proficiently on a PC you're going to have an uphill battle programming on an embedded target with difficult/limited internal visibility.
hello Andrew Neil... i have tried almost all the suggestions you maintained in previous reply.. i tried to display it on lcd bt it shows nothing.. i tried to blink LEDs it didn't work.. and instead of tera term i do connection with putty.. i.e microcontroller to gsm and its connection to usb to ttl in putty.. nothing worked.. what i am doing wrong??