Taskit RS232-ADC16, RS232-ADC24 User guide

RS232-ADC16/24
RS232-ADC16/24
Manual
Version 1.13
Copyright taskit GmbH 2009
www.taskit.de
Page 1/22
RS232-ADC16/24
Table of contents
5.1 LRC calculation................................................................................................7
6.1 Read Holding Registers...................................................................................8
6.2 Read Input Registers.......................................................................................8
6.3 Write Single Register.......................................................................................9
6.4 Write Multiple Registers...................................................................................9
6.5 Calibrate device.............................................................................................10
6.6 Save calibration data......................................................................................10
6.7 Error Response..............................................................................................11
7 Register description..............................................................................................12
7.1 Holding registers............................................................................................12
7.2 Input registers................................................................................................16
8 Techincal Details...................................................................................................17
8.1 RS232 connector...........................................................................................17
8.2 DSUB-25 connector.......................................................................................17
8.3 Electrical characteristics.................................................................................18
8.4 Reaction time.................................................................................................19
8.5 Power consumption........................................................................................20
8.6 Baud rate error...............................................................................................21
8.7 ADC................................................................................................................21
Page 2/22
RS232-ADC16/24

1 Features

C8051F350/C8051F352 microcontroller at 3 – 49 Mhz
RS232 interface
Eight analog 16/24-bit inputs
Eight digital 3.3V IOs (5V tolerant)
Supply voltage range from 4.5V – 15V (absolut max. 20V)
Provides 3.3V power supply for sensors
Seperated analog ground
Extended temperature range (-40°C – 85°C)
Small instruction set
Recalibration possible
Access via C-library

2 Introduction

RS232-ADC16/24 device is designed to give simple access to external sensors and peripherals over a standard RS232 connection. There is no need for any additional drivers when using Windows, DOS or Linux systems. Microcontroller only need a simple implementation of their UART interface.
Instructions send to the device have an human readable form allowing manual traffic checking for debugging proposes. To integrate RS232-ADC16/24 into your application, a C-library is provided with the device bearing the work of protocol parsing and packet construction.
The device comes in two versions, one with 16-bit and one with 24-bit ADC channels. These versions are named respectively to their ADC channel resolution RS232-ADC16 and RS232-ADC24.
This document contains information about hardware issues, the software protocol and resulting register mappings. It provides extra information for new firmware versions 1.11 & 1.12.
Page 3/22
RS232-ADC16/24

3 Bringing into service

The following steps illustrate how to setup the device correctly.
1. Connect DSUB-9 adaptor to serial port.
2. Configure serial port to 115200 baud, 8N1 (8 bit data, no parity, 1 stop bit).
3. Power the device. Use VIN (pin 24) and GND (pin 18) pins of DSUB-25 connector. (15V max)
After this, a terminal program should display RS232-ADC's boot message.
Referring to the advice given in the boot message sending a questionmark will produce a help text.
Page 4/22
RS232-ADC16/24

4 Application Sample

To illustrate the use of RS232-ADC16/24 – in special regard to VCC and VIN – you might consider this schematic overview.
The task is to obtain sensor's data and transfer it to a monitoring software. In case of critical or unusal conditions a nearby LED should indicate this. Obviously, up to eight pairs of sensor and LED can be controlled using one RS232-ADC16/24.
As described earlier, the device is powered via VIN at a maximum of 15V. The device's internal voltage regulator provides 3.3V at VCC to power external sensors. According to this, VCC should never be used to power RS232­ADC16/24. Furthermore the range of the analog input (0 – 2.5V) has to be taken in account.
Page 5/22
RS232-ADC16/24

5 Frame layout

This chapter specifies the used frame format. A frame does not contain more than one command; each command is send together with all of its parameters.
Parameters larger than eight bits are expected in big-endian format, which means the most significant byte (MSB) is send before the least significant byte (LSB).
On serial line each byte is send with eight bits, one start bit and one stop bit. There are no parity bits envolved in communication. The standard baud rate is 115200 baud. At the moment no handshaking is used because the host is intended to wait for a response before sending a new request. Handshake can be implemented in further versions as RS232-ADC16/24 provides a fully populated RS232 connector.
A frame is encoded in an human readable ASCII format. Therefore each byte of the frame's data is converted into two HEX digits. The converted frame then consists of one start character, the command and parameters in HEX digits, a packet LRC – also in HEX digits – and an end character.
Byte
1
Byte
2
Byte
3
Byte
4
Byte
5
... Byte
n-2
Byte
n-1
Byte
n
: Command Parameter
1
LRC <CR>
The end character is a "carriage return" (<CR>, '\r') resulting in hex code 0x0D. Any addional "new line" (<NL>, '\n', 0x0A) is ignored by device and added to any response.
Example : Read two ADC channels starting at 0x0001
Request :
:0400010002..<CR><NL>
Response :
:0404XXXXYYYY..<CR><NL>
Note : The first parameter is the byte count of read data, XXXX the value of channel1, YYYY the value of channel2. LRC checking in requests can be avoided by setting LRC to "..", replies always have a LRC although it is set to ".." in this example.
Page 6/22
RS232-ADC16/24

5.1 LRC calculation

The packet LRC is the two's complement of the sum over the packet's parameter and command bytes.
LRC = -((data
n
) + command); with datan as binary byte values of the packet's
parameter list and command as binary value.
The correct LRC for the sample request above would have been 0xF8.
In regard to this including the LRC of a received packet itself into calculation will result in a sum equal to 0, otherwise a transmission error has occured.
Note : Each binary data byte is transmitted as two HEX digits which have to be transformed into binary form before adding them.
Page 7/22
Loading...
+ 15 hidden pages