Vous êtes sur la page 1sur 4

Make Your Own USB HART Modem

Nesebar, Inc.
August, 2013

Copyright (c) 2013


Nesebar, Inc.
Revision 2
1. Introduction

You can make a HART™ Modem that connects to a USB port. The combination of the
Modem and PC form a HART Primary Master. The Modem is isolated from the HART network
and meets most HART specifications. It is powered through the USB port so that no power
supply is needed.

A diagram of the modem is shown below. The USB part of the modem is purchased (for
about $30). You need to add a modest amount of additional circuitry to complete the modem. A
PIC16F876A microcontroller buffers the data between the PC and the HART network. The
microcontroller code is available on the Nesebar website. The added circuitry includes the
A5191HRT modem chip [ 1 ].

Olimex PIC P28USB

USB to HART
Serial Network HART
To PC
Network
USB Cable Chip Interface
Tx
Rx Isolating
9600 bps TXA RXA
9600 bps
Transformer
/RTS
Tx
16F876A A5191
Rx
uC HRT
CD

Purchased Added

The USB interface is an Olimex PIC P28-USB [ 2 ]. This may be purchased (and its
schematic and instructions downloaded) from any of several distributors. It contains the socket
for the PIC16F876A microcontroller, which is also available from several sources.

The microcontroller may be programmed in a number of ways. One is to use an In-Circuit-


Debugger (ICD) made by Microchip [ 3 ]. A programming cable that connects the ICD to the
Olimex PIC P28-USB is available as the Olimex PIC-ICSP, also available from distributors.

Notice that the microcontroller has two serial ports: (1) A PC/USB port that uses only Tx
and Rx lines and runs at 9600 bps, and (2) a HART serial port that connects to the HART modem
chip using 4 signal lines and runs at 1200 bps. The PIC16F876A microcontroller has just one
hardware serial port, which is used as the HART port. The PC/USB port is a software port that
uses two of the microcontroller I/O lines.

2. Modem Schematic and Code

A schematic of the modem is given on the Nesebar web site at

http://www.nesebarinc.com/usb_hart_modem/schematic_6_3_2013.pdf. The modem circuit can


be built on the breadboarding area of the PIC P28-USB board.

The microcontroller code, including both a hex file and the source, is located at

http://www.nesebarinc.com/usb_hart_modem/code.zip.

The compiler used is available from CCS [ 4 ].

3. Changes to the PIC P28-USB Board

As shipped, the USB-to-Serial converter chip of the P28-USB is connected to the


microcontroller hardware port (Pins 17 and 18 of the microcontroller). Since these pins are to be
used as the HART port, the existing two connections must be cut and moved. This is illustrated
below.

Cut Traces

25 18
TXD RC7
24 17
RXD RC6

Original
USB Chip 16F876A

25 3 18
TXD RA1 RC7
24 4 17 To
RXD RA2 RC6 Modem
16
RC5 (A5191HRT)
15
Modified RC4

USB Chip 16F876A


Additionally, the components D1 and R12 on the PIC P28-USB board should be removed.

4. Setting Up USB Connection

Once the modem circuit is complete, connect the PIC P28-USB to a USB port on the PC
using the supplied USB cable. Bring up the “hardware manager” window of the PC. This is
done in different ways, depending on which version of Windows is being used. Go to “ports”.
There should be a new serial port present. This indicates that USB chip in the P28-USB is
connected to the PC. This serial port should be set up for 9600 bps, one start bit, one stop bit, no
parity, and no flow control. HART Master software should now be able to communicate with the
HART modem.

If the PC says that a driver must be installed, this can usually be downloaded from the
distributor that sells the PIC P28-USB or from Olimex.

5. Compatible Languages
Software to communicate with HART devices can be written in any language that supports
serial port communication. Examples are VBA, MATLAB, Python, Perl.

There is a command that can be issued to the modem itself as a test of whether the modem is
connected and operating. The modem does not pass this command on to the HART network.
The command consists of 0xFF, 0xFF, 0x8A. Upon receiving these 3 bytes in order, the modem
echoes these same bytes back to the PC.

6. References

1. A5191HRT Data Sheet, ON Semiconductor, 5005 East McDowell Road, Phoenix, AZ


85008, www.onsemi.com.

2. PIC P28-USB Data Sheet, Olimex, Ltd., 2 Pravda St., P.O. Box 237, Plovdiv 4000
Bulgaria, www.olimex.com.

3. Microchip Technology Inc., 2355 West Chandler Blvd., Chandler, AZ 85224,


www.microchip.com.

4. CCS, Inc., 1020 Spring City Drive, Waukesha, WI 53186, www.ccsinfo.com.

Vous aimerez peut-être aussi