Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

modem's AT commands and 8051

Status
Not open for further replies.

chardbiggie

Junior Member level 1
Joined
Dec 19, 2004
Messages
15
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
206
my project involves handshaking of 2 modems, one modem is connected to a cpu while another is connected to an 8051.
i am confused how to use the modem's AT commands in a 8051 microcontroller. I need to get the modem to communicate with the microcontroller so if the phone would ring, it would trigger the ring detect there would ba a handshakinging that would take place.

hope you could help me.
thanks for the replies in advance!
 

Dealing with modem AT commands is pretty easy - like sending and receiving text information through the UART. If you can handle UART part of your microcontroller (if not, look on www.8052.com for examples), then you can easy program your modem. For example, if you want to force modem to answering mode, you have to send the following string to uC UART which is connected to modem: "ATA" (without quotes). Then, when modem will receive ring signal from line, it will send back string "RING" for every incoming ring. "ATH1" will pick up and after connection sequence you will get answer string "CONNECTED" or "DISCONNECTED" from your modem. After that every byte which you will send to modem will be transmitted to another direction and vice-versa. To hook off you have to send string "ATH0".

If you want your modem to call specified number, for example 123, you have to send string "ATD123".

Check any online AT commands reference for more details.
 

please help, i also would like to ask the connection of the db 9, from the modem to the microcontroller
are all the pins in the db 9 be connected? or just three(TX,RX, ground) ? please help thanks
 

Needed configuration:

WIRING DIAGRAM
--------------------------

DB9-Male 8051 with RS-232 Driver IC (MAX202,.....)
-------- --------
1. DCD
2. RxD ----- TxD
3. TxD ----- RxD
4. DTR ----- DSR
5. Gnd ----- Gnd
6. DSR ----- DTR
7. RTS ----- CTS
8. CTS ----- RTS
9. RI

Please note that we cross over TxD / RxD, DTR / DSR, and RTS / CTS. We don't do anything with DCD and RI.
DSR, DTR, CTS and RTS are connected to selected 8051 pins connected trough RS-232 driver IC and your 8051 software has to handle with them somehow...
 

IanP said:
Needed configuration:

WIRING DIAGRAM
--------------------------

DB9-Male 8051 with RS-232 Driver IC (MAX202,.....)
-------- --------
1. DCD
2. RxD ----- TxD
3. TxD ----- RxD
4. DTR ----- DSR
5. Gnd ----- Gnd
6. DSR ----- DTR
7. RTS ----- CTS
8. CTS ----- RTS
9. RI

Please note that we cross over TxD / RxD, DTR / DSR, and RTS / CTS. We don't do anything with DCD and RI.
DSR, DTR, CTS and RTS are connected to selected 8051 pins connected trough RS-232 driver IC and your 8051 software has to handle with them somehow...

Modem can be connected to uC with 3 wires: RxD, TxD and GND (of course, by pointing them through the RS232 driver, like MAX232). Data flow control can by implemented with XON/XOFF. Carrier detect, ring detect etc. can be easy done by analyzing text responces from modem, as I already wrote before.
 

just like to ask if i burn the command -->print "ATA"
in the 8051 will the microcontroller answer the modem? i tried it and it's not working, im using 3 wire connection only the RX, TX and Grnd
please help... what do you think is the problem?
 

chardbiggie said:
just like to ask if i burn the command -->print "ATA"
in the 8051 will the microcontroller answer the modem? i tried it and it's not working, im using 3 wire connection only the RX, TX and Grnd
please help... what do you think is the problem?

"ATA" command forces modem to answering mode. So, when you send this command from uC to modem, it will wait for incoming call.

If you want to test connection between modem and uC, just send several times command AT to modem (of course, followed by <CR>!) - modem should answer with string "OK".
 

but how would i know that the modem would respond "ok" the microcontroller has no monitor like the PC... sorry m just confused, will the 3 wire connection work? oor we have to short rts and cts to the dtr...
 

The modem will respond an OK string meaning you have to catch this string and compare them to an OK string inside the microcontroller, you can try to create a an LED connected to the port and if all matches up, the LED will turn on.

Another you can try controlling your modem first at the Hyperterminal and take a look if can be controller by the Hyperterminal and gives an OK string.

Glenjoy
 

chardbiggie said:
but how would i know that the modem would respond "ok" the microcontroller has no monitor like the PC... sorry m just confused, will the 3 wire connection work? oor we have to short rts and cts to the dtr...

You will receive this "OK" as a usual input to your on-chip UART. So, for 8051 you will be able to read this "OK<CR>" byte-by-byte from SBUF register after every trigger to 1 of RI flag.
 

I think he can receive the data and put it into a memory allocation, he is using therefore it can be done even not byte by byte.

After the data has been stored into the memory allocation, he can compare now the readings.
 

to make a microcontroller anwser a call we used the followint commands
print "ATA cr"
and
Print "ATA"
print "cr"

which is more appropriate? or are there any other any way to answer the call?
 

chardbiggie said:
will the 3 wire connection work? oor we have to short rts and cts to the dtr...

Sorry, missed this question: on modem side RTS should be connected to CTS, DSR to DTR and DCD. Then you can use 3-wire communication. Do not forget to config XON/XOFF flow control.
 

im confused... 3- wire communication i connect the RX to the TX of the 8051 and the TX to the RX of the 8051 (of course using max232) and shorting the ground.
i connect RTS-CTS DSR-DTR and DCD but where would i connect it to the microcontroller...
 

If modem can operate with 3-wires these control signals can be connected in so called "null modem" configuration (RTS-to-CTS, DTR-to-DSR/CD) at modem side and they are not connected to microcontroller at all.
 

Ace-X said:
chardbiggie said:
will the 3 wire connection work? oor we have to short rts and cts to the dtr...

Do not forget to config XON/XOFF flow control.

Hi,

Where and how to implement XON/XOFF flow control? In RS232 terminal software there is a option for flow control, but how to do this on a uC? Please help me.

Thanks
 

Of course a Hayes AT compatible external modem.
 

yeah..i need a modem for my project, do you know any with reasnable price?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top