ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

AN INTELLIGENT SERIAL COMMAND INTERFACE


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

AN INTELLIGENT SERIAL COMMAND INTERFACE

Lessons from the Trenchesby Tom Napier

Start ę The HardwareThe Firmware ę Sources and PDF

One of the fun things about being a consultant is that you get asked to supply devices that are not commercially available. These are often not inherently difficult to develop, but they have such a specialized function that no company has considered manufacturing them.

I was recently asked to design a box to speed up the testing of telecommunications equipment. It needed to allow the computer running the tests to remotely switch either of two input signal lines to any of four inputs on the unit being tested. The box I designed to perform this task has unusual input and output connectors switched by relays (nothing particularly interesting there). However, the relays are switched by an 18-pin PIC microcontroller programmed as a smart modem.

THE SMART MODEM

The modem sits on a 9600-bps serial line that is transmitting data and control signals to other equipment. It reacts only to a specific pattern of characters and interprets them as relay switching commands. Up to seven devices can be coupled to the same serial line and controlled individually or globally. Luckily no transmit function was required, so there was no signal contention to consider.

The input impedance is 3.3 kilohms, the RS-232 standard. The serial input is a conventional 9-pin D connector wired in parallel with the other equipment, and if there had been panel space, I would have added a second connector to allow pass-through wiring of the signal. Fortunately, the transmitting computer is able to drive several RS-232 inputs in parallel.

A valid command consists of six printable ASCII characters, of which the first is a colon, the last is a semicolon, the second is the device address, and the remaining three are relay commands. Obviously this format can easily be extended. Each character has one start bit, eight data bits, and one stop bit, but the eighth (parity) bit is ignored.

The address character is any letter from A to G. Internal jumper plugs set the address of each device from 1 through 7. If a device is set to address 0 it responds to all command strings regardless of the address. The same command can be sent to all connected devices by using an "@" as the address character.

In the original device, all three command characters lay in the range of 0 to 4. Numbers 1 through 4 selected one of four output relays, and 0 turned all the relays off. Again, this could easily be expanded. Sending 0 through 3 as the third command character sent two TTL-level signals to an auxiliary connector to switch other equipment. Sending a 4 in this position reset the box to its default condition.

A typical command string such as :C220; switched both inputs of device C to their respective output 2 and left the auxiliary outputs high. The string :@114; reset all connected devices to their default condition. The first two digits donęt matter in this case.

NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ęCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ