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.

how to use PC modem with MCU ???

Status
Not open for further replies.

hm_fa_da

Full Member level 5
Joined
Sep 16, 2003
Messages
287
Helped
10
Reputation
20
Reaction score
4
Trophy points
1,298
Activity points
3,217
hi all ;


is it possible to use PC modem ( internal and external ) with MCU ?not for browsing web , for communicating between two MCU through phone line .

i mean there shouldn't be a PC used anymore , only one MCU board and a MODEM board .

thanks.
 

Hi,

An external modem is simple to use. Choose a basic Hayes compatible one. Hayes is the control set used to control the modem, make it dial, set the baud rate etc. Look up "hayes" in Google - you'll get plenty of info.

Then it's just a matter of using the MCU's serial (RS232) port to connect to the modem. You can pick up old, external modems really cheap now that everyone wants broadband.

You wouldn't want to use a PCI modem card, too much effort just to interface. You might be able to do an older ISA card, but there's no point - just get an external RS232 one.

Cheers,
FoxyRick.
 

hi ,

thansk for your answer ,

there is no problem using RS232 , i can use it , i searched web for hayes in googles and as you said found many results , i also found some pages describing the ATcommand set for these modems , but i haven't worked with AT command and in fact don't know a complete description of that , or how the hardware should be , or how instructions should be sent to modem in binary .

thanks ,
ragards.
 

I don't think it's really complicated - I have not played around with this (though I might) but used to use modems on simple serial dumb terminals years ago. Remember, all a simple modem does is to change serial data from RS232 levels to something that can get down a telephone line, and back again. Once set with a few commands, you just stream it your data and it comes out the other end. This can be as simple as typing characters into a dumb terminal.

There is a microprocessor inside an external modem that responds to the AT commands and sorts the traffic accordingly. There is a lot of info on making your own modem with a scenix MCU, so you don't even need an external modem.

Modems using Scenix:
See Circuit Cellar issue 107
http://techref.massmind.org/images/com/ubicom/www/http/pdf_files/SX_Modem_demo.PDF
http://www.sxlist.com/techref/scenix/lib/io/dev/modem/index.htm

Software modem with a dsPIC (I might try this!)
**broken link removed**

General info
http://www.epanorama.net/links/tele_access.html#modem

That lot might get you started. Remeber if you use a software modem (from a dsPIC or whatever), check the local regulations for connecting equipment to the telephone system. That's not a problem if you use a commercial external modem - it should already be approved.

You could even try playing with an external modem using a PC to learn it - just connect it to the serial port (you don't need to install a driver) and use Hyperterminal to talk to it.

Good luck,
FoxyRick.
Info on using xmodem error correction on PIC's
**broken link removed**
 

    hm_fa_da

    Points: 2
    Helpful Answer Positive Rating
Modem basics

The best way to start is to get 2 external RS232-modems, connect them using a phone line (*) and connect them to 2 PCs (**), run a terminal program on each PC. Type on one of them
ATD123456 (replace 123456 by the real telephone number of the other side)
you should hear how the modem "picks up", waits until dialtone, then dials, and you should hear the ringtone. At that moment, on the other side, the modem should send to terminal:
RING
and if a phone is attached, it should ring. Type on the other side:
ATA
you shold hear how the modems are negotiating (scratchy noises). After a while of whistling, both modems should write
CONNECT xxxxx
where xxxxx is some sort of speed (but usually with the factory setting they report only the speed how they are communicating to the PC, not to each other).

Now the modems are connected and in DATA MODE (as opposed to COMMAND MODE, in which the modem is after switching it on) and everything typed on one side is transmitted to the other and vice versa. You can have fun conversating with some friend...

If you want to hang up, you need to escape from DATA MODE to COMMAND MODE. Don't type anything for at least 1 second, then type rapidly 3 pluses (+++), then wait again for at least 1 second. The modem should write OK as a confirmation it is in COMMAND MODE. Then type ATH to hangup.


If you get the feeling, try playing with the AT command set - try the effect of each command. If you get lost, either switch the modem off and on, or try typing AT&F (factory reset).

Later you should also read more also on the handshaking (HW:RTS/CTS or SW:XON/XOFF) - while only humans are typing on a terminal, it is not important, but if computers start transmitting data, it becomes to be increasingly important. Also it is good to understand the meaning of other handshaking signals, it might e.g. spare some parsing problems (using RI instead of detecting the "RING" stream etc.).

And now, when you understand how the modem works, you can start implementing the routines on a mcu.

Have fun!

wek


(*) There are special (and usually more expensive) modems capable of connecting on a direct line (2 wires), these are called leased-line modems. However, they usually need some tweaking to get them into the leased-line mode, so it is generally not a good idea to start with these. Standard modems DO NEED the signals provided by the central, so you cannot simply connect 2 standard modems using 2 wires.

(**) Of course it can be a single PC with two COM ports and two terminal programs running; but it's quite a mess, not recommended for beginners.
 

    hm_fa_da

    Points: 2
    Helpful Answer Positive Rating
thanks for your help ,

it's really intresting to do that , but there is a problem , that i don't know how to write the routines in MCU , in fact i haven't worked with AT commands , is there any datasheet describing how to send AT commands with MCU , i mean for example when i want to send ATD123456 what binary data should i send to MODEM with MCU ?

i have seen that AT commands are useed in many projects , where are they used more ? how can we do with a mobile phone , other stuffs ... using AT command ?
if there is a good article or source for this subject , please guide me .

best ragrds.
 

If you can program a mcu and use the serial port on an mcu then you have all you need!

It you want to send AT to the modem from the mcu just send these 2 ascii characters followed by carriage return line feed over the serial port.

if send(byte) sends the byte over the serial port then just do:
send('A');
send('T');
send(0x0D);
send(0x0A);
with 0x0A the byte with hexadecimal value 0A

if recv() returns the byte received from the serial port then you'll get from the modem:
recv(); => 0x0D
recv(); => 0x0A
recv(); => 'O'
recv(); => 'K'
recv(); => 0x0D
recv(); => 0x0A

It's not difficult! Just serial port programming (on mcu or on pc or on ...)
 

hm_fa_da said:
for example when i want to send ATD123456 what binary data should i send to MODEM with MCU ?

Send ASCII codes.
"ATD123456" = 41h 54h 44h 31h 32h 33h 34h 35h 36h 0Dh
(the last character is the carriage return = ENTER on your keyboard).

For example, a google search on "8051 modem" gave me on the first position
**broken link removed**
with example in 8051 assembler. I am sure you can find plenty of similar pages for your mcu.

wek
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top