The OW-IO-AI product line is a range of 1-Wire to analog input devices. This article discusses interacting with the OW-IO-AI devices using an Embedded Data Systems' HA7E (or HA7S) 1-Wire Bus Master. The following are annotated examples of pseudo-code including the specific commands to send and typical responses received from the HA7E. In the examples below, TX= data transmitted to the HA7, and RX= data received from the HA7.
To better understand the commands and responses please refer to the data sheets for the OW-IO-AI which can be downloaded here:
Discover the Device
In this example, the OW-IO-AI is the only device on the 1-Wire bus, therefore we only use the 'S'earch Rom command once to identify the device:
Performing a standard device search: |
TX= S |
RX= 01000100002D0C7E |
Alternately, the 'F'amily search command could be used to discover all of the OW-IO-AI and EDS micro based 1-Wire slave devices :
Performing a family search for DS2406 devices: |
TX= F7E |
RX= 190000890020087E |
TX= f |
RX= 01000100002D0C7E |
...and so on, until all the EDS micro based 1-Wire slave devices have been enumerated at which point the 'f' command will simply return a carriage return.
Identifying device type.
All EDS micro based 1-Wire slave devices share the "7E" family code. To identify between models, the first 32 byte page includes a device description, firmware version, and part Id. To read the first first page, start by addressing the OW-IO-AI having ROM Id 440000000F738912.
TX= A01000100002D0C7E |
RX= 01000100002D0C7E |
Now invoke the OW-IO-AI Read Memory no CRC (0xF0), passing the two byte target address of 0x0000 and hold the bus high for the 32 byte memory page followed by a 2 byte CRC. The HA7 is limited to 32 bytes following the byte count. This requires two write blocks transmissions for the memory page to be fully read.
Reading page 0: | |
TX= W20A50000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
W - Write block 20 - Byte count A5 - Read memory 0000 - 2 Byte memory starting address FFs - Hold the bus high for OW-IO-AI response |
RX= A5000045445330303930204F6374616C20446973637265746520494F00202009 | |
TX= W05FFFFFFFFFF |
W - Write block 20 - Byte count FFs - Hold the bus high for the remaining bytes |
RX= 019000205D |
The following data received following "A50000" contains the following information in order:
- 28 Byte description tag in ASCII characters - “EDS0082 Octal 0-10v In”
- 2 Byte firmware version number (LSB) - 0201 (1.02v)
- 2 Byte part id number (LSB) – 0090 (9000)
- 16 Bit CRC following the memory page – 205D
The memory page data could alternatively be collected using the Read Pages "G" command:
Reading page 0 with alternative method: |
TX= A01000100002D0C7E |
RX= 01000100002D0C7E |
TX= G00 |
RX= 45445330303930204F6374616C20446973637265746520494F00202009019000 |
Reading Analog Inputs.
The OW-IO Analog inputs values, alarm states, and 2 Byte part id number are all stored in the 32 bytes of Page 1. This makes the most critical data able to be collected in one location.
Reading page 1: | |
TX= W20A52000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF |
W - Write block 20 - Byte count A5 - Read memory 2000 - 2 Byte memory starting address FFs - Hold the bus high for OW-IO-AI response |
A5200082000000000000000002010038040000A3230729010001000100010001 |
|
TX= W05FFFFFFFFFF |
W - Write block 20 - Byte count FFs - Hold the bus high for the remaining bytes |
RX= 0001004CE5 |
Page 1 Contents + 16 Bit CRC:
82000000000000000002010038040000A32307290100010001000100010001004CE5
The memory map for page one is available in the User Manual (page 2 of 10). Below is a break down of individual pieces of data:
Part Id | Reserved | Relay & LED State | Alarm States | Seconds Counter | Input 1 | Input 2 | Input 3 | Input 4 | Input 5 | Input 6 | Input 7 | Input 8 |
8200 | 00000000000000 | 02 | 0100 | 38040000 | A323 | 0729 | 0100 | 0100 | 0100 | 0100 | 0100 | 0100 |
Calculating the Input Value
The input voltage is calculated by taking the number and dividing it by 2048. Please note that the Input reading is store with the Least Significant Byte First. Below are three examples from the previously read contents from Page 1:
Input 1 | Input 2 | Input 3 | |
0xA323 LSB = 0x23A3 MSB | 0x0729 LSB = 0x2907 MSB | 0x0100 LSB = 0x0001 MSB | Converting from Least Significant Byte first (LSB) to Most Signifcant Byte first (MSB) |
0x23A3 = 9123 Decimal | 0x2907 = 9123 Decimal | 0x0001 MSB = 1 Decimal | Converting from Hexidecimal (0x) to Decimal numbers |
9123/2048 = 4.45458984375 Volts | 10503/2048 = 5.12841796875 Volts | 0/2048 = 0.00048828125 Volts | Divide by 2048 for the Voltage reading |
More information soon to come...
Comments
0 comments
Article is closed for comments.