CONNECTING A MODEM TO 8051 |
I disclaim everything. It is not my responsability what can happens if you follow what is in here. Everything was my own research and discoveries.
This is not an advertisement for Rockwell or any other company, and the intention of this text is just helps you that intends to attach a modem chip to your 8051 project.
This project, as
you can see here, including the GIF file drawing,
was used in one of my own company project that is working overseas in South-America.
It is a portable equipment to collect and communicate to a central computer
office. So, what you see here is real and not just a guess, it works!!!
Years ago, before the massive use of Internet with speedy modems, the industry produced millions of PC fax/modem cards 2400/9600bps, with a purpose of computer faxing capabilities. Today you can find thousands of those cards with a soqueted RC224ATF chip on it.
This chip is capable to initiate or answer a call, it only needs few components around. In this project we will cover only the function of "initiate a call", even though, to answer a call is just a matter to include few other components to make the chip receive the "ring signal".
The RC224ATF uses several self connection pins, you can see those lines at pins 22-43, 48-23 and so on.
The crystal frequency must be 16MHz, and it needs the capacitors 82pF and 47pF.
Pin 57 (/TEST), must be tied up.
Pin 54 (/RESET) resets the chip while at low level. It is wise to connect this pin to the 8051 reset using a 74HCT04 or similar inverter gate, so the modem will be reset along with the 8051.
Pin 20 (/DTR) needs a low level. The chip needs to recognize that there is an active DTE (data terminal equipment) or CPU attached to works with.
Pin 6 (WAKEUP) when tied up it puts the chip to sleep, saving power. Needs to be at low level to makes the chip operational. You can use a 8051 pin port to disable the chip when it is not necessary.
Pin 19 (TXDATA) connects to 8501 Tx pin.
Pin 14 (RXDATA) connectes to 8051 RX pin.
No other pin needs to be connected to the 8051, except for the digital ground..
Pin 53 needs to receive a filtered 5V, via the 10 Ohms resistor and two capacitors.
Pin 40, is a power relay driver output, and it can drives directly a relay coil around 10mA. It is wise to protect the chip using an inverted diode in the coil, and a capacitor close to the relay to avoid noises.
Pin 3 is the Ring input, and as in this project we are not expecting any calls, this pin needs to be pulled up to VCC via a resistor any value between 10k to 100k.
Capacitors at pins 34, 35 and 36 are factory mandatory and no different values were tested, so be careful.
Pin 33 is the analog Rx data, while the 32 is the analog Tx. Both are tied together via the 536 Ohms resistor, while both signals return via the secondary of the phone line transformer to the pin 31.
To protect the chip, we use two 1N748A diodes, in a anode-anode configuration, so it will clip any arriving signal bigger than the diodes zener voltage. The capacitor C14 offers an extra filtering for high frequencies and voltage peaks.
The phone-line transformer is a regular 600+600 Ohms found in any fax/modem card and there are plenty available at Digikey, Jameco, JDR and others catalog companies. Individual cost from $4 to $12. Any phone line transformer (600+600 Ohms) will work satisfactory.
To protect everything, a varistor (130V) is connected directly to the transformer primary coil, so it will clip any signal above those limits. You can also use an electronic device "Transient Voltage Suppressor" TVS, or a Sidac (Surge Protector), in a TO92 pinout costing around $1 each for single quantities (Digikey p/n P1500EA-ND).
It is connected to
the phone line via a 47 Ohms resistor (1W) and a relay, here used a single
SPST.
There are plenty
of relays available at the market for that purpose, costing around $3,
just select one with low current. Those fax/modem cards are a good supplier
;)
Both analog and digital grounds, pins 39 and 60 and 61 must be tied together just at one single point.
Pins 2 and 21 controls how the modem enters in idle mode in some circunstances, and at this project both go to ground.
Pin 5 /Seren, select if the chip will be used in serial or parallel mode. Serial when tied to ground. In parallel mode the pinout change completelly and it needs much more control lines from the 8051.
Pin 54 is the speaker output with weak signal. Iff you want to hear the tones and noises you need to amplify this signal with a LM358 audio amplifier. You can find the easy drawing at the LM385.JPG file in this web page.
Pin 38 is the Talk Relay power driver output, that could be used for a secondary relay not used in here.
Pins 68, 63, 65, 64, 62 are not used in this project, and they are related to extra control and physical protocol between the modem and the DTE.
Pins 8, 16 and 7, are the three lines to attach an e2prom to this chip, so it can store phone numbers and some configurations, we do not need it in here.
There is nothing
special in this circuit and it works pretty well at 2400bps. There
is no necessity for error correction or things like that. At this speed
our actual phone lines can traffic data without any problems.
Anyway, you could
implement a software CRC or SUMM check characters for block transmission
and reception to ensure data integrity.
You can use a soquet to plug this plcc 68 pins chip to your printed circuit board, or if you have good hands and eyes, you can solder the chip that is only .05" pins spaced, not so bad, just half the distance from a regular dip .1" spacing chip. Just use a good small iron tip and a low temperature solder. Take extra care not to form solder bridges between pins and clean the chip pins before solder, since if it was soqueted, probably may exist some oxidation on the bottom of the pins.
The assembler software (modem.asm) you find in this web page, is a resume and example how you can control the modem via a 8051 core. I collected some routines from a bigger program and put it all together to your reference. Note that the main reason for that asm text is to show you how the chip needs to be programmed and how it answers at the first commands, starting a dial and so on.
After reset, the chip enters in command mode, so it answers to anything you send to it in verbal mode. It will answer "OK" when accepting a command and it is followed by character 0Dh (carriage return).
After you send the programming sequence you can see on the file, it changes the answers to numeric mode, so it will answers with a character 30h (digit "0") instead of "OK", or any other number for a different meanning.
After you command ATDT and a telephone number, it will dial it using DTMF tones. After the other modem answers and they handshake, they will enter in data mode, so the last thing you will receive from your modem will be a digit "1" (hexa 31h) or "5" meanning the connection speed, 2400 or 1200bps.
After that, it will be fully in data mode, and the only things it will delivers to you will be the data sent by the remote modem, until it returns to command mode forced by disconnection or by your command.
Good luck, enjoy it, and if you have any doubt about it, dont hesitate, just email me.
|
|
Individual RC224ATF chip, including a pinout description copy from Rockwell books |
|
Components kit #3, including all the components from the drawing, kits #1 and #2 |
|
Have fun,