Serial Communications / Protocol in Airtest Products: General
Serial Communications / Protocol in Airtest Products: General
Serial Communications / Protocol in Airtest Products: General
General
The standard sensor has two different ways of serial select hardware wire. This latter bus is intended for
communication with sensor’s peripherals and the communications with internal system functions and
outside world. One is through the UART (Universal plug-in-cards in a slave mode using a chip select
Asynchronous Receiver and Transmitter) and signal from the sensor microprocessor. One such
another through the Microwire bus. Basically, they plug-in-card is the -LON option, which connects an
differ in such a way that the sensor communicates Echelon neuron and turns the system into a
via UART only when it is requested, but only in- LonMark labelled CO2-Temp-Occupancy triple
between sensor measurements, whereas the sensor for advanced digital networks.
Microwire bus is always used to send information
after each measurement cycle as signalled by a chip
The intended UART communication protocol is a The master has to answer after a time-out period of
master/slave one. Communication can be initiated minimum 8.2 msec counted from the last stop bit
only by one node of the network, the master of the has been shifted into master’s UART to the first
net. Sensor is always a slave. Baud rate is 9600, start bit transition of shifting out byte by sending the
other settings are 8 data bits, 1 stop bit, no parity. Message Request (MR), that contains up to a
maximum of 8 bytes. These8 bytes include task
The UART protocol is intended for both RS232 and code and check sum. The time interval between
RS485 communication with other master. The high bytes must not exceed 4 msec in order to let slave to
accuracy of the sensor requires the measurements to distinguish RTS and data bytes. If more data is to
have the top priority. Hence, the total cycle is be exchanged, a new RTS has to be sent for each 8
divided into two sequential time slots - byte package.
measurement and communication. During the
measurements the UART communication is If the sensor receives and understands the MR
disabled, and it is reinitialised at the beginning of message, the sensor UART will respond by sending
communication time slot. Sensor can stay in a Data Code (DC) containing the data requested,
measurement time slot for as long as 0.8 sec. that contains up to a maximum of 8 bytes. These8
bytes include Acknowledgement (ACK) and check
The communication protocol is written in such a sum. In case of an execution command, only an
way that any communication starts externally by Acknowledgement (ACK) will be sent after
sending to the sensor’s UART one Request To command execution. Slave must provide time
Send (RTS) byte. Master must provide 8.2 msec interval between bytes to be less than 4 msec to
silence on the communication bus before and after prevent interpretation data bytes as RTS by any
RTS in order to let slave to identify that the byte other slave in the RS485 network.
should be interpreted as RTS. In addition master
shall give a sensor at least 21.5 msec after RTS to Any detected communication error (frame errors,
prepare answer. check sum mismatch etc.) as well as detected
application error (invalid task code, run time error
Received during measurement time slot bytes are of execution commands etc.) results in reinitialising
ignored. of sensor communication without any report on the
communication bus (no NACK). Master can detect
As soon as the RTS byte is received and the presence of sensor in the net due to CTR
successfully identified, the slave will respond by response. After execution command fail master
sending a Clear To Receive (CTR) byte. shall check sensor status.
tCTR_WAIT tMR_DLY
tDByte
…
TDX
RTS
RTS
RTS
MR(3-8bytes)
Sensor 1
tRTS_RCGN
tRTS_RCGN
Measurement
time slot end
RTS
matc tDByte
tRTS2CTR tDC_DLY
…
TDX
CTR
tMR_WAIT DC(1-8bytes)
Sensor 2
tRTS_RCGN
No RTS No RTS
tRTS_RCGN
tRTS_RCGN
tRTS_RCGN
recognition recognition
on data on data
tRTS_RCGN
The value <FE> holds for all sensors. In addition, each unit may be assigned an individual
network address (INA) in the range 1...29, in which case a unit selective RTS is possible by
sending the byte value <E0+INA>. Sensors not assigned with an INA also respond to <E0>.
The message request consists of 3 mandatory and one optional field. Message Request can be 3
to 8 bytes long, depending on the amount of data to be transferred.
A pure request for data (bit 7 in<task code> =1) is always 3 bytes long:
<task code>,<address>,<chksm>
Description of fields follows:
<task code> - one byte mandatory field
bit 7 bit 6 bit 5 bit 4 bit 3 Bit field 2..1..0 Check Description
x x x x x 000 Reserved Is interpreted as communication
error by present version, no NACK
Standard Commands (read/write RAM) bit 7 0 = write to RAM,
1 = read from RAM
bit 6 0 = lower RAM ,
1 = upper RAM
0 0 0 0 0 Number of data =< 5 Write to lower RAM
bytes to be written
0 1 0 0 0 (not 0)
Write to higher RAM
1 0 0 0 0 Number of data =< 6 Read from lower RAM
bytes to be read
1 1 0 0 0 (not 0)
Read from higher RAM
bit 7 bit 6 bit 5 bit 4 bit 3 Bit field 2..1..0 Check Description
Special commands (read/write EEPROM)
0 0 0 0 1 Number of data =< 4 Write to EEPROM.
bytes to be written
(not 0)
1 0 0 0 1 Number of data =< 6 Read from EEPROM.
bytes to be read
(not 0)
Note:
1. Read/write EEPROM commands are used with 2-byte address. First address byte in MR
represents high byte of address, second address byte in MR represents low byte of
address.
2. EEPROM is byte-organised in pages of 16 byte each. First address of each page is given
by XXX0h, last address of the page is given by XXXFh. Write command MUST write into ONE
page at the time ONLY! Otherwise the first addresses of current page will be overridden.
Notes:
1. Any deviation of checked parameter results in recognition of communication error and sensor
communication reinitialising. Sensor starts to look for new RTS.
2. Any unrecognised task code results in recognition of communication error and sensor communication
reinitialising. Sensor starts to look for new RTS.
<address> - one byte mandatory field, start address to read/write. High (MSB) byte of address in 2-byte
address for EEPROM read/write commands.
(<address>) - one byte optional field, start address to read/write. Low (LSB) byte of address in 2-byte
address for EEPROM read/write commands.
(<data>,...) – optional field, data, 5 bytes maximum for one byte addressed commands, 4 bytes maximum
for 2-byte addressed command write to EEPROM.
<chksm> - one byte mandatory field, lsb of a pure summation of the previous MR bytes
The DC string always starts with a communication status byte ACK. If data are requested, the
DC string is 3 to 8 bytes long, depending on the amount of data. The DC code fields description
is the following:
<ACK> - Acknowledgement, - one byte mandatory field, can be one of following two:
<06> - indicates that MR was successfully received and/or command was successfully executed.
<86> = <06> + bit 7 set = MR successfully received and/or command was successfully executed
+sensor event flag is set
<chksm> - if data field presents, it is one byte mandatory field, lsb of a pure summation of the previous
DC bytes.
The sensor hardware pin R/T will be in low logic level (receive) at all times, except for the short periods of
UART transmit time when it will go high. Standard baud rate is 9600 b/s.
Transmit example #2 Collecting the present sensor CO2 reading from a sensor that
has detected some hardware error:
This kit is primarily for use during sensor installations, reconfigurations, and maintenance and is included
together with necessary PC software in the User Interface Program VT (STRATEGY).
option -485 add-on-PCB - for fixed installation to external computer using the RS485
Standard commands
Collecting Temperature and CO2 values <84><14><98> <ACK><Thi><Tlo><CO2hi><CO2lo><chksm>
Collecting CO2 values <82><16><98> <ACK><CO2hi><CO2lo><chksm>
Collecting Temperature values <82><14><96> <ACK><Thi><Tlo><chksm>
Collecting Error Code <81><43><A8> <ACK><Error Code><chksm>
Collecting Individual Network Address <C1><50><11> <ACK><INA><chksm>
Assigning Individual Network Address <41><50><INA> <ACK>
<chksm>
Reading Alarm Status byte, <C1><7F><40> <ACK><AlarmStatus><chksm>
Bit #7 contains copy of DT active flag.
This position of DT active flag is
supposed to be supported for
compatibility with future devices.
Special command
Read from EEPROM
Execution commands
Save sensor INA in EEPROM <A1><00><A1> <ACK>
Save sensor RAM in EEPROM <99><AD><46> <ACK>
Copy EEPROM variables into RAM <91><00><91> <ACK>
Reset TWA (Time Weighted Average) <B9><01><BA> <ACK>
stack
Note:
1. In this chart Temperature and CO2 values equals parameter 1 & 2 (channel 0 and channel 1) in the general representation.
2. Notice, that immediately after powering up (or restarting after power fail) correct data
is not available from the sensor. Reasonable data on measured parameters like
temperature or carbon dioxide concentration appears in 3..7 seconds after power up
and data of specified precision is available after specified warm-up time. Data on TWA
of carbon dioxide becomes available in one minute after powering up.
Generally, EEPROM itself is design to provide maximum data security. After power up it comes to write
protected mode. But in order to have additional protection against accidental write to EEPROM due to, for
example, uC program error, some portion of EEPROM can be protected from write by means of additional
programming of EEPROM. Protected in such way portion can not be programmed even after ordinal write enable
command, but additional reprogramming is required.