In many embedded systems, it’s desirable to have modem connectivity to the controlled device. Also desirable is the ability to communicate to more than one device within a facility using only one telephone line. Modem designs (especially for the fastest baud rates) often are complicated and require specialized expertise to develop. Many small companies that design embedded systems can’t afford the regulatory expenses and expertise necessary to design and manufacture modems themselves.
This idea shows a method of using a 33.6-kbit/s Socketmodem from Conexant to provide an embedded modem inside one device and the ability to communicate with external devices over an RS-485 bus. By adding only a few external components, the Socket-modem provides a fully functional modem that’s compliant with all regulatory requirements. Socketmodems are available that are compliant with telephone regulations in North America and several European countries.
Referring to the figure, it can be seen that microcontroller U1 lies at the heart of the embedded system. It can interface to ADCs, DACs, user displays, etc., but this Idea For Design is concerned with its asynchronous serial port connection to the rest of the circuit. Data from the asynchronous port goes to and from both the modem module U3 and the RS-485 transceiver U5.
The microcontroller can set the direction of the RS-485 bus with its general-purpose I/O line OUT1. The RS-485 transceiver is Texas Instruments’ SN75176B. The microcontroller could be any of the various devices available on the market, such as the MC68332 from Motorola.
Because RS-485 is a half-duplex interface and the modem has a full-duplex interface, there must be some method of controlling when the modem drives the RS-485 bus. The method in this design incorporates a PIC12C671 microcontroller from Microchip (the less-expensive PIC 12C508 also can be used if its internal operating frequency of 4 MHz is sufficiently fast for the baud rate to be utilized).
This microcontroller (U2) monitors the RXD line from the modem module U3. The idle state of the RXD line is high. When the PIC sees a high-to-low transition on the RXD line, it asserts line PIC_DRV. This signal passes through AND gate U4A and turns on the driver in RS-485 transceiver U5.
When the RXD line goes high again, the PIC continues driving the PIC_DRV line for a short time, so that the RS-485 transceiver drives the RS-485 bus into the idle state. The PIC then de-asserts the PIC_DRV line. Resistors R1 and R2 hold the RS-485 bus in the idle state until the next low transition on the RXD line or until an external device drives the RS-485 bus.
The program code for the PIC microcontroller is given (see the listing). In this implementation, the PIC continues driving the RS-485 bus when the RXD line goes to the idle state for approximately half of a 19,200-bit/s bit time. This makes the system usable for all baud rates up to 19,200. If a faster baud rate is desired, it may be necessary to use an external oscillator to run the PIC faster than it can with its internal oscillator (4 MHz).
Using AND gates U4B, C, and D, the data from any of the three sources (modem, main microcontroller, and RS-485 bus) is routed to the other two. The protocol used must account for the fact that the system is half-duplex.
The modem module interfaces to the phone line through the TIP and RING lines. These lines are protected from surges by a Teccor Sidactor A1. Other filtering and protection circuitry may be necessary to pass regulatory standards, such as FCC Parts 15 and 68.
This idea shows a simple modem interface for an embedded system. Other unused Socketmodem features, such as a speaker output, voice input, caller ID interface, etc., may be useful in a real-world application.