Use A PC Serial Port For Pulse-Encoded Communications

April 13, 2006
The simple method described here evaluates a one-wire device that uses pulse-width-encoded communications from a PC serial port. Communications errors such as parity and acknowledge are monitored. The hardware interface to the PC is a MAX232 driv

The simple method described here evaluates a one-wire device that uses pulse-width-encoded communications from a PC serial port. Communications errors such as parity and acknowledge are monitored. The hardware interface to the PC is a MAX232 driver/receiver, and the slave in this example case is a Texas Instruments TMP141 temperature sensor. The circuit can be expanded to four sensors on the same bus by using the TMP141's four programmable addresses derived from A0 and A1 (Fig. 1).

The main scheme for this method is to use the built-in timing of the RS-232 baud-rate control. Three "bit codes" are required for most communications: (Start bit), data (bit 0), and data (bit 1) (see the table and Fig. 2). Using mscomm in Visual Basic, the PC COM port is configured to output 8 data bits, parity None, 1 Stop bit, and flow control none. The setting of COM port data bits along with the baud rate determines the bit-code widths. Baud rate is changed between bits to create the different pulse-width codes.

Reprogramming the PC COM port baud rate can create a delay of 20 to 30 ms between bits, but this is okay because there's no time-out event in the slave. Yet the delays can make it a challenge to read the output on a logic analyzer. The Visual Basic program controls two-way communication to the TMP141 sensor. The program allows internal registers to be read and programmed. Details of communication execution are in the Visual Basic program, which can be downloaded at ED Online 12237 at www.electronicdesign.com.

Sponsored Recommendations

What are the Important Considerations when Assessing Cobot Safety?

April 16, 2024
A review of the requirements of ISO/TS 15066 and how they fit in with ISO 10218-1 and 10218-2 a consideration the complexities of collaboration.

Wire & Cable Cutting Digi-Spool® Service

April 16, 2024
Explore DigiKey’s Digi-Spool® professional cutting service for efficient and precise wire and cable management. Custom-cut to your exact specifications for a variety of cable ...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!