beautypg.com

A.4.4 writing a variable – ENMET EX-6165 User Manual

Page 24

background image

EX-6120, 6165 SERIES IR

ENMET Corporation

21

A.4.2 Reading a Variable

Send a read frame with the Variable ID to be read:

DLE

RD

var-id

DLE

EOF

Csum hi

Csum lo

Byte stuffing

Device response on success, where requested variable data < 255 bytes:

DLE

DAT

data-len

data

DLE

EOF

Csum hi

Csum lo

Byte stuffing

Device response on failure:

DLE

NAK

reason


Where ‘reason’ is a single byte failure code, the meaning of which depends on the device type, i.e.
Reason = 1, NotReadable,
Reason = 2, ReadOutOfRange

A.4.3 Read example - read live data

The following example is based on V4.x.xE where the data is either byte or integer types only.

Send the following bytes:

DLE, RD, Variable ID, DLE, EOF, Checksum High byte, Checksum low byte i.e.

0x10, 0x13, 0x01, 0x10, 0x1F, 0x00, 0x53

Device response on success:

DLE, DAT, Data length, Data, DLE, EOF, Checksum High byte, Checksum low byte, i.e.

0x10

DLE

0x1A

DAT

0x0D

Data length

0x03

Version

0x01

Display mode

0x07

Sensor Type

0x00, 0x00

Gas reading (signed integer x 100) = 0

0xAE, 0x0B

Current sensor temperature (signed integer x 100) = 29.9

0x92, 0x08

Active sensor signal (unsigned integer) = 2194

0xD7, 0x04

Reference sensor signal (unsigned integer) = 1239

0x10

DLE

0x1F

EOF

0x02

Checksum high byte

0x9F

Checksum low byte

A.4.4 Writing a Variable

Send a write frame with the Variable ID to be written:

DLE

WR

WP1

WP2

var-id

DLE

EOF

Csum hi

Csum lo

Byte stuffing

Device response on success:

DLE

ACK

Where data to write is < 255 bytes, send a DAT frame:

DLE

DAT

data-len

data

DLE

EOF

Csum hi

Csum lo

Byte stuffing

Device response on write success:

DLE

ACK

Device response on write failure:

DLE

NAK

reason

Where ‘reason’ is a single byte failure code, the meaning of which depends on the device type, i.e.
Reason = 1, NotWritable
Reason = 2, WriteOutOfRange
Reason = 3, BadDataLength
Reason = 4, IncorrectVersion

This manual is related to the following products: