Burkert 8056 User Manual

SE 56
E
RRSS223322 SSEERRIIAALL PPOORRTT RRSS448855 SSEERRIIAALL PPOORRTT
EETTPP aanndd MMOODDBBUUS
S PPRROOTTOOCCOOLL
AAPPPPLLIICCAATTIIOONN NNOOTTE
EDITION APRIL 2008
RS232_485_ETP_MODBUS_BU_REV02.doc
INDEX
1. THE HARD WARE CONNECTION WITH THE CONVERTER...................................................................................4
1.1. ML XXX............................................................................................................................... .................................................4
1.2. ML XXX............................................................................................................................... .................................................4
1.3. ML XXX............................................................................................................................... .................................................4
1.4. ML XXX............................................................................................................................... .................................................4
1.5. ML XXX............................................................................................................................... .................................................4
2. AVAILABLE PROTOCOLS ............................................................................................................................................4
3. DPP (DATA PACKET PROTOCOL) .............................................................................................................................5
3.1. INTRODUCTION TO DATA PACKET PROTOCOL............................................................................................................5
3.2. BCP PROTOCOL (BASIC COMMUNICATION PROTOCOL) ............................................................................................5
3.2.1.INTRODUCTION ............................................................................................................................................................5
3.2.2.DATAWORDFORMAT ..................................................................................................................................................5
3.2.3.DATABLOCKFOR MAT ..................................................................................................................................................6
3.2.4.COMMUNICATIONSPEED.............................................................................................................................................6
3.2.5.SERIALPORTSETTINGSFORRS232ANDRS485..........................................................................................................6
3.2.6.COMMANDFORMATS ..................................................................................................................................................7
3.2.7.READINGTHETYPEOFINSTRUMENTANDTHESOFTWAREVERSION .........................................................................7
3.2.8.READINGPROCESSDATAFROMML210 .......................................................................................................................8
3.2.9.READINGPROCESSDATAFROMML211 .....................................................................................................................10
3.2.10.READINGPROCESSDATAFROMML212 ..................................................................................................................12
3.2.11.READINGPROCESSDATAFROMML3F1 ...................................................................................................................13
3.2.12.SETTINGTHESETPOINTOFTHEML212 ..................................................................................................................15
3.2.13.READINGTHEINTERNALDATALOGGERDATAOFML210/211/212 ....................................................................15
3.2.14.READINGTHEEVENTSONINTERNALDATALOGGERDATAOFML210/211/212 .................................................16
3.2.15.READINGTHEMAXMINONINTERNALDATALOGGERDATAOFML210 ................................................................17
3.2.16.LETTURAVALORIMINMAXDELLOGGERINTERNODIML211 ................................................................................17
3.2.17.WRITINGTHEDATEANDTIMEORRESETTHEENABLEDTOTALIZERS .....................................................................18
3.2.18.SEND/RECEVEBATCHPROCESSDATAML210/ML3F1 ..........................................................................................18
3.3. ETP PROTOCOL (ENCAPSULATED TRANSFER PROTOCOL) ...................................................................................... 20
3.3.1.INTRODUCTION ..........................................................................................................................................................20
3.3.2.DATAWORDFORMAT ................................................................................................................................................20
3.3.3.COMMUNICATIONSPEED...........................................................................................................................................20
3.3.4.SERIALPORTSETTINGSFORRS232ANDRS485PORT ..............................................................................................21
3.3.5.GENERALINPUTSYSNTAX ..........................................................................................................................................21
3.3.6.SPECIALCHARACTERS.................................................................................................................................................22
3.3.7.ACCESSCODEFORFUNCTIONWITHPRIVILEGELEVEL ...............................................................................................22
3.3.8.DATABLOCKFOR MAT ................................................................................................................................................23
3.3.9.EXAMPLEOFETPCOMAND ........................................................................................................................................24
3.3.10.EXAMPLEOFRESPONSEFORPRECECDENTETPCOMAND.......................................................................................24
3.3.11.COMUNICATION ................................................................................................................... ....................................25
3.3.12.SUGGESTIONSFORRS485INTERFACEUSE...............................................................................................................26
3.3.13.FLOWCHARTFORSENDINGETPCOMMANDANDRECEPTIONOFTHEANSWER....................................................28
3.3.14.LISTOFSUPPORTEDCOMMANDSGROUPEDSIMILARLYTOTHEINTERNALMENUSYSTEM ..................................30
3.3.15.ETPCOMMANDLISTINALPHABETICALORDER .......................................................................................................64
4. HTP PROTOCOL (HYPER TEXT PROTOCOL) ........................................................................................................67
4.1. INTRODUCTION ............................................................................................................................... ...............................67
4.2. DESCRIPTION AND USE .................................................................................................................................................67
- 2 - RS232_485_ETP_MODBUS_BU_REV02.doc
4.3. HTP PROTOCOL............................................................................................................................... ................................68
5. MODBUS FIELD BUS.................................................................................................................................................. 71
5.1. INTRODUCTION ............................................................................................................................... ...............................71
5.2. RS485 HARDWARE CONNECTION ............................................................................................................................... .71
5.3. DATA WORD FORMAT ....................................................................................................................................................71
5.4. COMMUNICATION SPEED .............................................................................................................................................. 71
5.5. SERIAL PORT SETTINGS ............................................................................................................................... .................71
5.6. PARAMETER SETTINGS ............................................................................................................................... ...................72
5.7. STANDARD FUNCTIONS............................................................................................................................... ..................72
5.8. CUSTOM FUNCTION .......................................................................................................................................................77
5.9. EXAMPLE OF SOURCE CODE FOR VB .NET 2005 PROJECT........................................................................................80
6. APPENDIX.................................................................................................................................................................. 100
6.1. RS232 SERIAL PORT.....................................................................................................................................................100
6.1.1.CONNECTINGTHECONVERTERVIARS232PORTTOAPRINTER ..............................................................................100
6.1.2.CONNECTINGTHECONVERTERVIARS232PORTTOAPC/MODEM ........................................................................102
6.2. RS485 SERIAL PORT.....................................................................................................................................................103
6.2.1.CONNECTINGTHECONVERTERVIARS485SERIALPORT .........................................................................................103
6.2.2.CONNECTINGTHECONVERTERTOANRS485NETWORK ........................................................................................104
6.2.3.CRITERIAFORDATAEXCHANGE ...............................................................................................................................104
6.2.4.TYPESOFDEVICEFORTHENETWORKCONNECTION ...............................................................................................104
6.2.5.EXTENDINGTHENETWORK ......................................................................................................................................104
- 3 - RS232_485_ETP_MODBUS_BU_REV02.doc
t
t
t
1. THE HARDWARE CONNECTION WITH THE CONVERTER
1.1. ML XXX
1.2. ML XXX
1.3. ML XXX
1.4. ML XXX
1.5. ML XXX
2. AVAILABLE PROTOCOLS
DPP = Data Packet Protocol
Proprietary of Millennium series : it’s a network protocol based on data packets; over this protocol it’s possible to
encapsulate other protocols like BCP (Basic Communication Protocol) or ETP (Encapsulated Transfer Protocol)
HTP = Hyper text protocol
It’s a textual protocol used in point to point connections. ETP commands can be used over HTP
MODBUS = field bus
It’s a standard field bus that can be used over point to point or over network connections; MODBUS can encapsulate ETP commands
RS 232 port
RS 485 por
DPP protocol  HTP protocol  MODBUS protocol
DPP protocol  MODBUS protocol
RS 232 por
RS 485 por
- 4 - RS232_485_ETP_MODBUS_BU_REV02.doc
3. DPP (DATA PACKET PR OTOCOL)
3.1. INTRODUCTION TO DATA PACKET PROTOCOL
With Data Packet Protocol it is possible to communicate with the flow meter through protocols with data packets. The protocols with data packets available for the flow meter are BCP protocol (Basic Communication protocol) and the ETP protocol (Encapsulated Transfer protocol)
The flow meter have two serial port, the RS 232 port and the RS 485 port. When the aux module with the RS 232 port is present in the flow meter, the menu
have the function «RS232 pr.» for the selection of the protocol type.
When the DPP setting is selected in the
possible to send command to RS 232 port of the flow meter with the protocol BCP or with the protocol ETP.
When the flow meter have the option of the MODBUS protocol, the menu
function «RS485 pr.» for the selection of the protocol type. The possible selections are MODBUS or DPP.
When the DPP setting is selected in the
possible to send command to RS 485 port of the flow meter with the protocol BCP or with the protocol ETP.
If the flow meter don’t have the MODBUS option, the
Communication» and the default protocol type for the RS 485 port is DPP.
For the use of the commands and the structure of the BCP protocol see the relative section. For the use of the commands and the structure of the ETP protocol see the relative section.
function «RS232 pr.» of the menu «7-Communication», it is
function «RS485 pr.» of the menu «7-Communication», it is
«7-Communication»
«7-Communication» have the
function «RS485 pr.» is not present in the menu «7-
3.2. BCP PROTOCOL (BASIC COMMUNICATION PROTOCOL)
3.2.1. INTRODUCTION
The BCP protocol is a set of formatted commands based on an index.
It is possible to read data from the flow meter as Process data or the Data Logger and it is possible to send command to the flow meter as the start stop batch for example.
The protocol is available for the RS 232 and for the RS 485 serial port.
3.2.2. DATA WORD FORMAT
The data bytes travelling in serial form on the communication line are enclosed in 10 bits:
1 START BIT 8 DATA BITS = 1 BYTE DI DATI 1 STOP BIT
Each word contains one byte of data plus additional bits which serve to synchronise and make the communication safer. These extra bits are added automatically in the transmission phase by the transmitter integrated circuit. In the
words
which have a fixed length of
- 5 - RS232_485_ETP_MODBUS_BU_REV02.doc
reception phase, the reverse operation is executed by the receiver integrated circuit: the eight data bits are extracted and the others are eliminated. These operations are executed entirely on a hardware level. The 8 data bits must be serialised staring from bit 0 (the least significant one).
3.2.3. DATA BLOCK FORMAT
Communication takes place through data blocks or packs of variable length which do not exceed 256 bytes overall. A data block or pack is composed thus::
ADDRESS TO, Containing the address of the device the block is sent to;
ADDRESS FROM, Containing the address of the device which sent the block;
COMMAND, Containing the command code the block refers to;
LENGTH, Containing the length of the data block in bytes
DATA BYTES, The block of data of variable length from zero to 250
CRC CHECKSUM BYTE, Calculated in the following way:
1. CRC initialised to zero
2. CRC rotated to the left by one bit
3. CRC = CRC + block bytes
The process is repeated starting from point 2. for all the block bytes, excluding CRC..
NOTE:
The CRC must be subjected to an operation of
The difference is shown in the following example:
byte value: 10100010 shifting : 1 <= 0100010 <= 0 rotating: 1 1 <= 0100010 <= 1
A block can contain a maximum of 90 data bytes. A block which does not contain data bytes is formed solely by ADDRESS TO + ADDRESS FROM + COMMAND + LENGTH + CRC CHECKSUM, with LENGTH value equal to zero.
rotation to the left
and not just a simple
shift
operation.
3.2.4. COMMUNICATION SPEED
The millennium series instruments have 4 communication speeds::
4800 bps
9600 bps
19200 bps
38400 bps
3.2.5. SERIAL PORT SETTINGS FOR RS 232 AND RS 485
Serial port settings:
Data bits: 8
Parity: none (no parity)
Stop bits: 1
Flow control: none (no control lines no xon/xoff characters used)
- 6 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.6. COMMAND FORMATS
A
command
command is the return of one block with the requested data having the same command code + 128 (80H). The following command codes are available:
codice Action performed by the measuring device after receiving the command.
0 Send the 1 Send the 2 Send the 3 Receive
4,5,6,7,9,
10,13
8 11 Send events data(ML210/211/212) 12 Send 14
NOTE: the commands indicated with the term "RESERVED" are used during factory calibration and diagnosis, are
In this description, the command codes in hexadecimal and (decimal) format and the related data format are shown. The numeration of the bits is from 0 (LSB) to 15 (MSB). The numeration of the bytes received is from 0 to N, where 0 is the first byte received and N is the last.
is defined as an operating code of 1 byte specifying the type of operation required. The reply to this
type of instrument process data data logger’s data
date and time
RESERVED
Send or receive data for batch
min/max
Set set-point
protected by a special password and must not be used by the user under any circumstance.
(ML210/211/212)
(ML212)
and
version
(for all models)
(ML210/211/212)
(ML210/211/212)
(ML210 / ML3-F1)
of the software ( all model )
reset the enabled totalizers
( all model )
3.2.7. READING THE TYPE OF INSTRUMENT AND THE SOFTWARE VERSION
Command code: 0 Command format: ADDRESS TO + ADDRESS FROM + 00H + 00H + CRC CHECKSUM Reply data format: bytes 0..5: device name («ML 210») byte 6: software version (major number) byte 7: software version (minor number) bytes 8-9: (16 bits unsigned integer, byte 8=MSB):
hardware / software enabling flags, bit 0 = LSB, bit 15 = MSB:
bits Functions ML210/211/3f1 Functions ML212
0-2 current access level (0..7) current access level (0..7)
3 channel 1 impulses in use impulses for volume in use 4 channel 2 impulses in use duty cycle actuator type in use 5 channel 1 frequency in use frequency for flow rate in use 6 channel 2 frequency in use frequency for actuator in use 7 scale range 2 in use on/off type actuator in use 8 specific weight in use specific weight in use
9 additional output 3 present additional output 3 present 10 additional output 4 present additional output 4 present 11 output 4..20 mA 2 present output 4..20 mA 2 present 12 RS232 present input on/off n.2 present 13 batching functions active analog inputs 1 and 2 present 14 output 4..20 mA 2 present output 4..20 mA 1 present 15 RS485 present RS485 present
- 7 - RS232_485_ETP_MODBUS_BU_REV02.doc
EXAMPLE:
want to send the command 00H to a measuring device located at address 11H (17 decimal).The device
that interrogates the network has the address FFH (255 decimal). The block to send will be composed thus
address of the measuring device to interrogate (ADDRESS TO) | | address of the device that interrogates the network (ADDRESS FROM) | | | | command for reading TYPE of INSTRUMENT (COMMAND) | | | | | | data block length (LENGTH) | | | | | | | | checksum of the entire block (CRC CHECKSUM) | | | | | 11H FFH 00H 00H 84H
The reply from the measuring device will be the following:
address of the device that interrogated the network and which now must receive the reply (ADDRESS TO) | | address of the measuring device which sent the message (ADDRESS FROM) | | | | command for reading the TYPE of INSTRUMENT + 80H (128 dec.) (COMMAND) | | | | | | length of the data block (=10 bytes) (LENGTH) | | | | | | | | type of instrument («ML 200») | | | | | | | | | | versione software (major.minor) | | | | | | | | | | | | hardware / software enabling flags | | | | | | | | | | | | | | CRC CHECKSUM) | | | | | | | | FFH 11H 80H 0AH 4D 4C 20 32 30 30H 01 02H C0 08H 21H
The measuring device has replied that it is an ML200, that its software version is the 1.02, that it has enabled the RS485 serial port, that the output is 4..20mA and that it is using impulse emission on channel 1 (this last information is taken from the hardware / software enabling flags).
3.2.8. READING PROCESS DATA FROM ML 210
The process data is contained in a memory block which the user can request whole or in part, depending on the content of the two command control bytes. Byte 0 (offset) indicates which will be the first data byte of the block to send, whilst byte 1 specifies the number of successive data bytes we want. In this way we can obtain exactly the data we want or several pieces of data at the same time.
Command code: 01 Command format: ADDRESS TO
+ ADDRESS FROM + 01H + 02H
+ byte 0: offset – start of block to transmit + byte 1: length of block to transmit + CRC CHECKSUM
- 8 - RS232_485_ETP_MODBUS_BU_REV02.doc
Reply data format when the sending of the entire block is requested (byte 0 = 0 and byte 1 = 46):
bytes 0-3: (32 bit single precision IEEE floating point, MSB first) flow rate in % bytes 4-7: (32 bit single precision IEEE floating point, MSB first) flow rate scale range in t.u. bytes 8-11: (32 bit single precision IEEE floating point, MSB first) flow rate in t.u. bytes 12-16: (5 bytes ASCII) flow rate measurement unit bytes 17-19: (3 bytes ASCII) measurement unit of the counters byte 20: (8 bits integer) number of decimals after the point for totalizers display byte 21: (8 bits integer) number of decimals after the point for flow rate display bytes 22-25: (32 bit long integer, MSB first) totalizer for TOTAL volume + bytes 26-29: (32 bit long integer, MSB first) totalizer for PARTIAL volume ­ bytes 30-33: (32 bit long integer, MSB first) totalizer for TOTAL volume - ( or ML210 dosage quantity) bytes 34-37: (32 bit long integer, MSB first) totalizer for PARTIAL volume - (or ML210 dosed quantity) bytes 38-41: (32 bit long integer, MSB first) clock expressed in minutes starting from 01-01-1992 bytes 42-43: (16 bit unsigned integer, MSB first) process flags:
bit 0 =1 if the excitation is too fast for the sensor connected bit 1 =1 if the maximum alarm is active bit 2 =1 if the minimum alarm is active bit 3 =1 if the flow rate exceeds the scale range value (overflow) bit 4 =1 if one or more output impulses are saturated (too many impulses to emit) bit 5 =1 if the measurement signal is highly disturbed or if the sensor is disconnected bit 6 =1 if the measurement tube is empty bit 7 =1 if the circuit powering the coils is not working or the sensor is disconnected bit 8 =1 if the second measurement scale is active bit 9 =1 if the flow rate is lower than the cut-off threshold bit10=1 if the flow rate is negative bit11=1 if a new measurement value calculated for the display is available bit12=1 if the counter block signal is active bit13=1 if dosing is in progress
bit14=1 if a calibration cycle is in progress bit15=1 if a flow rate simulation is in progress
byte 44: (8 bits integer) measurement samples per second (Hz) byte 45: (8 bits integer) measurement dynamic variation as a %
To request the transmission of a single parameter, assign the values of byte 0 and byte 1 in the request as follows, bearing in mind that the data in the memory block has fixed positions:
PARAMETER TO READ Byte 0 Byte 1 Flow rate in % 0 4 Scale range of the flow rate in technical units 4 4 Flow rate in technical units 8 4 Flow rate measurement unit 12 5 Totalizers measurement unit 17 3 Decimal figures for the totalizers 20 1 Decimal figures for flow rate display 21 1 Totalizer for TOTAL volume + 22 4 Totalizer for PARTIAL volume + 26 4 Totalizer for TOTAL volume - (or dosage quantity) 30 4 Totalizer for PARTIAL volume -(or dosed quantity) 34 4 Date and time in minutes 38 4 Process flags 42 2 Measurement samples per second in Hz 44 1 Measurement dynamic variation in % 45 1
NOTES: The values in the “32 bits single precision IEEE floating point” format are floating point numbers which can
be represented during writing by any decimal digits. To keep the same numerical format visible on the instrument display however, it is necessary to calculate the decimal figures with a rather complex algorithm which takes account of instrument precision, flow rate measurement unit, etc. For this purpose
- 9 - RS232_485_ETP_MODBUS_BU_REV02.doc
and to avoid useless calculations, the number of decimals to use to represent the flow rate values is supplied separately (byte position 21).
The counters are expressed with a 32 bit integer. The «counter decimal figures» parameter, indicates the point position starting from the right: 0 = no decimal, 1=1 decimal figure, and so on. The date and time are expressed with a 32 bit integer containing the number of minutes elapsed since 01-01-1992. To calculate the date starting from this number, see the programming examples at the end of this manual.
3.2.9. READING PROCESS DATA FROM ML 211
This command is similar to the preceding one and differs from it only for the quantity of the data given.
Command code: 01 Command format: ADDRESS TO
+ ADDRESS FROM + 01H + 02H + byte 0: offset – start of block to transmit + byte 1: length of block to transmit
+ CRC CHECKSUM
Reply data format when the sending of the entire block is requested (byte 0 = 0 and byte 1 = 78):
bytes 0-3: (32 bit single precision IEEE floating point, MSB first) flow rate in % bytes 4-7: (32 bit single precision IEEE floating point, MSB first) flow rate scale range in t.u. bytes 8-11: (32 bit single precision IEEE floating point, MSB first) flow rate in t.u. bytes 12-16: (5 bytes ASCII) flow rate measurement unit bytes 17-19: (3 bytes ASCII) measurement unit of the counters byte 20: (8 bits integer) number of decimals after the point for volume totalizers display
byte 21: (8 bits integer) number of decimals after the point for flow rate display
bytes 22-25: (32 bits long integer, MSB first) totalizer for volume + bytes 26-29: (32 bits long integer, MSB first) totalizer for volume ­ bytes 30-33: (32 bits long integer, MSB first) totalizer for energy + bytes 34-37: (32 bits long integer, MSB first) totalizer for energy ­ bytes 38-41: (32 bit long integer, MSB first) clock expressed in minutes starting from 01-01-1992 bytes 42-44: 3 x (8 bits unsigned char) 3 bytes of process flags:
byte 0:
bit 0 =0 (not used) bit 1 =1 if the flow rate is lower than the cut-off threshold
bit 2 =1 if the flow rate is negative bit 3 =1 if a new measurement value calculated for the display is available bit 4 =1 if the counter block signal is active
bit 5 =0 (non used)
bit 6 =1 if a calibration cycle is in progress bit 7 =1 if a flow rate simulation is in progress
byte 1:
bit 0 =1 if the temperature sensors are disconnected or broken
bit 1 =1 if the maximum alarm for the flow rate is active bit 2 =1 if the minimum alarm for the flow rate is active
bit 3 =1 if a measure exceeds the scale range value (overflow) bit 4 =1 if one or more output impulses are saturated (too many impulses to emit)
bit 5 =1 if the measurement signal is highly disturbed or if the sensor is disconnected bit 6 =1 if the measurement tube is empty bit 7 =1 if the circuit powering the coils is not working or the sensor is disconnected
- 10 - RS232_485_ETP_MODBUS_BU_REV02.doc
byte 2:
bit 0 =1 if the maximum alarm for the thermal power is active bit 1 =1 if the minimum alarm for the thermal power is active bit 2 =1 if the maximum alarm for the delta T is active
bit 3 =1 if the minimum alarm for the delta T is active bit 4 =1 if the maximum alarm for the temperature T1 is active bit 5 =1 if the minimum alarm for the temperature T1 is active bit 6 =1 if the maximum alarm for the temperature T2 is active
bit 7 =1 if the minimum alarm for the temperature T2 is active
byte 45: (8 bits integer) number of measure samples per second (hertz) bytes 46-49: (32 bits single precision IEEE floating point, MSB first) thermal power in % bytes 50-53: (32 bits single precision IEEE floating point, MSB first) full scale thermal power in t.u. bytes 54-57: (32 bits single precision IEEE floating point, MSB first) thermal power in t.u. bytes 58-62: (5 bytes ASCII) measure unit for the thermal power bytes 63-66: (4 bytes ASCII) measure unit for the thermal energy byte 67: (8 bits integer) number of decimals after the point for energy totalizers display byte 68: (8 bits integer) number of decimals after the point for thermal power display byte 69: (8 bits integer) measure unit for the temperature (C or F degrees) bytes 70-73: (32 bits single precision IEEE floating point, MSB first) delta T value in t.u. bytes 74-77: (32 bits single precision IEEE floating point, MSB first) T1 temperature in t.u. bytes 78-81: (32 bits single precision IEEE floating point, MSB first) T2 temperature in t.u.
To request the transmission of a single parameter, assign the values of byte 0 and byte 1 in the request as follows, bearing in mind that the data in the memory block has fixed positions:
PARAMETRO DA LEGGERE Byte 0 Byte 1 Flow rate in % 0 4 Full scale flow rate 4 4 Flow rate in technical units 8 4 Measure unit for the flow rate 12 5 Measure unit for the volume totalizers 17 3 Number of decimal digit after the point for volume totalizers 20 1 Number of decimal digit after the point for the flow rate 21 1 Totalizer for volume + 22 4 Totalizer for volume - 26 4 Totalizer for thermal energy + 30 4 Totalizer for thermal energy - 34 4 Time and date expressed in minutes 38 4 Process flags 42 3 Number of samples per second in Hz 45 1 Thermal power in % 46 4 Full scale thermal power in t.u. 50 4 Thermal power in t.u. 54 4 Measure unit for the thermal power 58 5 Measure unit for the thermal energy 60 3 Number of decimal digit after the point for energy totalizers 63 1 Number of decimal digit after the point for the th. power 64 1 T in technical units 65 1 Delta T in t.u. 66 4 T1 value in t.u. 70 4 T2 value t.u. 74 4
NOTE: For the numeric representations and the number of decimal digits, see the preceding point.
- 11 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.10. READING PROCESS DATA FROM ML212
This command is similar to the preceding one and differs from it only for the quantity of the data given.
Command code: 01 Command format: ADDRESS TO
+ ADDRESS FROM + 01H + 02H + byte 0: offset – start of block to transmit + byte 1: length of block to transmit
+ CRC CHECKSUM
Reply data format when the sending of the entire block is requested (byte 0 = 0 and byte 1 = 59):
bytes 0-3: (32 bit single precision IEEE floating point, MSB first) flow rate in % bytes 4-7: (32 bit single precision IEEE floating point, MSB first) flow rate scale range in t.u. bytes 8-11: (32 bit single precision IEEE floating point, MSB first) flow rate in t.u. bytes 12-16: (5 bytes ASCII) flow rate measurement unit bytes 17-19: (3 bytes ASCII) measurement unit of the counters byte 20: (8 bits integer) number of decimals after the point for volume totalizers display
byte 21: (8 bits integer) number of decimals after the point for flow rate display
bytes 22-25: (32 bits long integer, MSB first) totalizer for volume + bytes 26-29: (32 bits long integer, MSB first) totalizer for volume -
bytes 30-33: (32 bits long integer, MSB first) totalizer for actuator closing pulses bytes 34-37: (32 bits long integer, MSB first) totalizer for actuator opening pulses bytes 38-41: (32 bit long integer, MSB first) clock expressed in minutes starting from 01-01-1992 bytes 42-43: (16 bit unsigned integer, MSB first) process flags:
bit 0 =1 if the deviation alarm is active bit 1 =1 if the maximum alarm is active bit 2 =1 if the minimum alarm is active bit 3 =1 if the flow rate exceeds the scale range value (overflow) bit 4 =1 if one or more output impulses are saturated (too many impulses to emit) bit 5 =1 if the measurement signal is highly disturbed or if the sensor is disconnected bit 6 =1 if the measurement tube is empty bit 7 =1 if the circuit powering the coils is not working or the sensor is disconnected bit 8 =1 if the measure sample rate is too high for the sensor bit 9 =1 if the flow rate is lower than the cut-off threshold bit10=1 if the flow rate is negative bit11=1 if a new measurement value calculated for the display is available bit12=1 if the counter block signal is active bit13=1 if the actuator positioning alarm is active
bit14=1 if a calibration cycle is in progress bit15=1 if a flow rate simulation is in progress
byte 44: (8 bits integer) measurement samples per second (Hz)
byte 45: (8 bits integer) measurement dynamic variation as a %
bytes 46-49: (32 bits single precision IEEE floating point, MSB first) set-point value in % bytes 50-53: (32 bits single precision IEEE floating point, MSB first) regulator output value in % bytes 54-57: (32 bits single precision IEEE floating point, MSB first) deviation value in % byte 58: (1 byte ASCII) regulator status flags:
bit 0 =1 if the regulator is in “manual” mode bit 1 =1 if the regulator output is inverted bit 2 =1 if the regulator output is in “safety” state bit 3 =1 if the deviation alarm is active bit 4 =1 if the actuator alarm is active
- 12 - RS232_485_ETP_MODBUS_BU_REV02.doc
bit 5 =1 if the measure at the AIN1 input is out of range
bit 6 =1 if the measure at the AIN1 input is out of range
To request the transmission of a single parameter, assign the values of byte 0 and byte 1 in the request as follows, bearing in mind that the data in the memory block has fixed positions:
PARAMETER TO READ Byte 0 Byte 1 Flow rate in % 0 4 Full scale flow rate 4 4 Flow rate in technical units 8 4 Measure unit for the flow rate 12 5 Measure unit for the volume totalizers 17 3 Number of decimal digit after the point for volume totalizers 20 1 Number of decimal digit after the point for the flow rate 21 1 Totalizer for volume + 22 4 Totalizer for volume - 26 4 Totalizer for actuator closing impulses 30 4 Totalizer for actuator opening impulses 34 4 Date and time in minutes 38 4 Process flags 42 2 Measurement samples per second in Hz 44 1 Measurement dynamic variation in % 45 1 Set-point value in % 46 4 Regulator output value in % 50 4 Deviation value in % 54 4 Regulator status flags 58 1
NOTE: For the numeric representations and the number of decimal digits, see the preceding point.
3.2.11. READING PROCESS D ATA FROM ML 3F1
The process data is contained in a memory block which the user can request whole or in part, depending on the content of the two command control bytes. Byte 0 (offset) indicates which will be the first data byte of the block to send, whilst byte 1 specifies the number of successive data bytes we want. In this way we can obtain exactly the data we want or several pieces of data at the same time..
Command code: 01 Command format: ADDRESS TO
+ ADDRESS FROM + 01H + 02H
+ byte 0: offset – start of block to transmit + byte 1: length of block to transmit + CRC CHECKSUM
Reply data format when the sending of the entire block is requested (byte 0 = 0 and byte 1 = 46):
bytes 0-3: (32 bit single precision IEEE floating point, MSB first) flow rate in % bytes 4-7: (32 bit single precision IEEE floating point, MSB first) flow rate scale range in t.u. bytes 8-11: (32 bit single precision IEEE floating point, MSB first) flow rate in t.u. bytes 12-16: (5 bytes ASCII) flow rate measurement unit bytes 17-19: (3 bytes ASCII) measurement unit of the counters byte 20: (8 bits integer) number of decimals after the point for totalizers display byte 21: (8 bits integer) number of decimals after the point for flow rate display bytes 22-25: (32 bit long integer, MSB first) totalizer 1 bytes 26-29: (32 bit long integer, MSB first) totalizer 2 bytes 30-33: (32 bit long integer, MSB first) everytime to 0
- 13 - RS232_485_ETP_MODBUS_BU_REV02.doc
bytes 34-37: (32 bit long integer, MSB first) everytime to 0
bytes 38-41: (32 bit long integer, MSB first) everytime to 0 bytes 42-43: (16 bit unsigned integer, MSB first) process flags
bit 0 =1 if the excitation is too fast for the sensor connected bit 1 =1 if the maximum alarm is active bit 2 =1 if the minimum alarm is active bit 3 =1 if the flow rate exceeds the scale range value (overflow) bit 4 =1 if one or more output impulses are saturated (too many impulses to emit) bit 5 =1 if the measurement signal is highly disturbed or if the sensor is disconnected bit 6 =1 if the measurement tube is empty bit 7 =1 if the circuit powering the coils is not working or the sensor is disconnected
bit 8 =1 if the second measurement scale is active bit 9 =1 if the flow rate is lower than the cut-off threshold bit10=1 if the flow rate is negative bit11=1 if a new measurement value calculated for the display is available bit12=1 if the counter block signal is active bit13=1 if dosing is in progress
bit14=1 if a calibration cycle is in progress bit15=1 if a flow rate simulation is in progress
byte 44: (8 bits integer) measurement samples per second (Hz)
byte 45: (8 bits integer) measurement dynamic variation as a %
To request the transmission of a single parameter, assign the values of byte 0 and byte 1 in the request as follows, bearing in mind that the data in the memory block has fixed positions:
PARAMETRO DA LEGGERE Byte 0 Byte 1 Flow rate in % 0 4 Scale range of the flow rate in technical units 4 4 Flow rate in technical units 8 4 Flow rate measurement unit 12 5 Totalizers measurement unit 17 3 Decimal figures for the totalizers 20 1 Decimal figures for flow rate display 21 1 Totalizer for T1 22 4 Totalizer for T2 26 4 Process flags 42 2 Measurement samples per second in Hz 44 1 Measurement dynamic variation in % 45 1
NOTES: The values in the “32 bits single precision IEEE floating point” format are floating point numbers which can
be represented during writing by any decimal digits. To keep the same numerical format visible on the instrument display however, it is necessary to calculate the decimal figures with a rather complex algorithm which takes account of instrument precision, flow rate measurement unit, etc. For this purpose and to avoid useless calculations, the number of decimals to use to represent the flow rate values is supplied separately (byte position 21).
The counters are expressed with a 32 bit integer. The «counter decimal figures» parameter, indicates the
point position starting from the right: 0 = no decimal, 1=1 decimal figure, and so on.
The date and time are expressed with a 32 bit integer containing the number of minutes elapsed since 01­01-1992. To calculate the date starting from this number, see the programming examples at the end of this manual.
- 14 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.12. SETTING THE SET-POINT OF THE ML212
With this command it is possible to send the set-point value in % format to the ML202. If the value is positive, this is intended as REMOTE set-point value and must be refreshed continuously. The maximum time between two refreshes it is regulated by the same timer used to signal the deviation alarm condition and thus it is freely changeable. If the value sent is negative, it is considered as LOCAL set-point value and in this case it is not necessary to refresh it continuously. In any cases the regulator receives the absolute value of the number sent.
Command code: 14 Command format: ADDRESS TO
+ ADDRESS FROM + 0EH + 04H
+ 32 bits IEEE floating point containing the set-point value in % + CRC CHECKSUM
The same number is returned as answer by the ML212
3.2.13. READING THE INTERNAL DATA-LOGGER DATA OF ML210 / 211 / 212
The data logger can be read one record at a time with this command. If we assign the value AAH to the byte specifying the address (byte 0), the data logger is cancelled. If we request the address of a record not present in the memory, the returned data has no sense. For this purpose we recommend starting from the request for record 0 and to check the number of records present in the memory which is returned by the measuring device.
Command code : 02 Command format: ADDRESS TO
+ ADDRESS FROM + 02H + 01H
+ byte 0: index of the data logger data to read, AAH to cancel the entire content + CRC CHECKSUM
Reply data format in the case where there are registrations present:
byte 0: (8 bits integer) number of record requested
byte 1: (8 bits integer) total number of records present in the memory bytes 2-5: (32 bits long integer, MSB first) data saving time and date expressed in minutes starting from 01-01-
1992 bytes 6-9: (32 bits long integer, MSB first) data counted + bytes 10-13: (32 bits long integer, MSB first) data counted ­bytes 14-17: (32 bits single precision IEEE floating point, MSB first) portata in u.t. bytes 18-20: (3 bytes ASCII) (3 bytes ASCII) counter measurement unit byte 21: (8 bits integer) number of decimal figures after the point for counter display bytes 22-26: (5 bytes ASCII) flow rate t.u.
byte 27: (8 bits integer) number of decimal figures after the point for flow rate
Reply data format in the case where registrations are NOT present or the data logger is disabled
byte 0: (8 bits integer) requested record number byte 1: (8 bits integer) total number of records present in the memory
Reply data format in the case where the AAH cancellation code is sent:
byte 0: (8 bits integer) AAH code.
NOTE: The time and date of sample collection is expressed in minutes starting from 01/01/1992. For conversion, see
the programming examples at the end of this manual.
- 15 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.14. READING THE EVENTS ON INTERNAL DATA-LOGGER DATA OF ML210 / 211 / 212
The data logger can be read one record at a time with this command. If we assign the value AAH to the byte specifying the address (byte 0), the data logger is cancelled. If we request the address of a record not present in the memory, the returned data has no sense. For this purpose we recommend starting from the request for record 0 and to check the number of records present in the memory which is returned by the measuring device..
Command code : 11 Command format: ADDRESS TO
+ ADDRESS FROM + 0BH + 01H
+ byte 0: index of the data logger data to read, AAH to cancel the entire content + CRC CHECKSUM
Reply data format in the case where there are registrations present:
byte 0: (8 bits integer) number of record requested byte 1: (8 bits integer) total number of records present in the memory bytes 2-5: (32 bits long integer, MSB first) data saving time and date expressed in minutes starting
from 01-01-1992
bytes 6-9: (32 bits long integer, MSB first) flags events
bit 00: error sensor RTD / batch alarm bit 01: alarm max flow bit 02: alarm min flow bit 03: alarm overflow bit 04: alarm overflow pulse bit 05: input error bit 06: pipe empty bit 07: coils interrupt bit 08: alarm max t. power bit 09: alarm min t. power bit 10: alarm max delta T bit 11: alarm min delta T bit 12: alarm max T1 bit 13: alarm min T1 bit 14: alarm max T2 bit 15: alarm min T2 bit 16: current loop open bit 17: power supply error
Code 000300FFH or 0003FFFFH = means converter switch on
Reply data format in the case where registrations are NOT present or the data logger is disabled
byte 0: (8 bits integer) requested record number byte 1: (8 bits integer) total number of records present in the memory
Reply data format in the case where the AAH cancellation code is sent:
byte 0: (8 bits integer) AAH code.
NOTE: The time and date of sample collection is expressed in minutes starting from 01/01/1992. For conversion, see
the programming examples at the end of this manual.
- 16 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.15. READING THE MAX-MIN ON INTERNAL DATA-LOGGER DATA OF ML210
The data logger can be read one record at a time with this command. If we assign the value AAH to the byte specifying the address (byte 0), the data logger is cancelled. If we request the address of a record not present in the memory, the returned data has no sense. For this purpose we recommend starting from the request for record 0 and to check the number of records present in the memory which is returned by the measuring device..
Command code: 12 Command format: ADDRESS TO
+ ADDRESS FROM + 0CH + 01H
+ byte 0: index of the data logger data to read, AAH to cancel the entire content + CRC CHECKSUM
Reply data format in the case where there are registrations present:
bytes 0-3:(32 bits IEEE floating point, MSB first) MAX FLOW RATE IN T.U. bytes 4-7:(32 bits IEEE floating point, MSB first) MIN FLOW RATE IN T.U.
3.2.16. LETTURA VALORI MIN-MAX DEL LOGGER INTERNO DI ML211
The data logger can be read one record at a time with this command. If we assign the value AAH to the byte specifying the address (byte 0), the data logger is cancelled. If we request the address of a record not present in the memory, the returned data has no sense. For this purpose we recommend starting from the request for record 0 and to check the number of records present in the memory which is returned by the measuring device..
Command code: 12 Command format: ADDRESS TO
+ ADDRESS FROM + 0CH + 01H
+ byte 0: index of the data logger data to read, AAH to cancel the entire content + CRC CHECKSUM
Reply data format in the case where there are registrations present :
bytes 0-3:(32 bits IEEE floating point, MSB first) MAX FLOW RATE IN T.U. bytes 4-7:(32 bits IEEE floating point, MSB first) MIN FLOW RATE IN T.U. bytes 8-11:(32 bits IEEE floating point, MSB first) MAX T. POWER IN T.U. bytes 12-15:(32 bits IEEE floating point, MSB first) MIN T. POWER IN T.U. bytes 16-19:(32 bits IEEE floating point, MSB first) deltaT MAX IN T.U. bytes 20-23:(32 bits IEEE floating point, MSB first) deltaT MIN IN T.U. bytes 24-27:(32 bits IEEE floating point, MSB first) T1 MAX IN T.U. bytes 28-31:(32 bits IEEE floating point, MSB first) T1 MIN IN T.U. bytes 32-35:(32 bits IEEE floating point, MSB first) T1 MAX IN T.U. bytes 36-39:(32 bits IEEE floating point, MSB first) T1 MIN IN T.U.
- 17 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.2.17. WRITING THE DATE AND TIME OR RESET THE ENABLED TOTALIZERS
Codice comando: 03 Formato comando: ADDRESS TO
+ ADDRESS FROM + 03H + 04H + 32 bits long integer containing the date and time expressed in minutes starting from 01-01-
1992, or the value FFFFFFFFH to reset the totalizers the most significant byte must be sent first.
+ CRC CHECKSUM
Reply data format: the same block is returned containing the current clock value in minutes. If the value sent is
outside the limits, (date beyond 31-12-2091), the clock restarts from 01-01-1992. In case of totalizers reset, the same value FFFFFFFFH is returned.
3.2.18. SEND / RECEVE BATCH PROCESS DATA ML210 /ML 3F1
The batch data can be read or written with the command described below. Th command contains an OPCODE byte specifying the operation type to be done on the selected batch data. With these commands one of the 16 batch memories can be written, read or it can be set as active batch process. Once set a selected batch memory, it will be possible start, stop or reset the batch process. To set a batch memory as active batch process, a write or read command can be used indifferently, but the bit 6 of the OPCODE must be set to 1
– Command for reading a batch data memory:
Command code: 08 Command format: ADDRESS TO
+ ADDRESS FROM + 08H + 01H (1 DECIMALE) + OPCODE byte, operation code:
bits 0..4 = number of the batch memory to be read (0..15) bit 5 = must be set to zero bit 6 = 1 if this batch memory must be set as active batch process, 0 if this batch
memory is to be read only.
bit 7 = must be set to zero
+ CRC CHECKSUM
Format of the returned data: 16 bytes containing the batch data for the selected memory:
bytes 0-7: (8 bytes ASCII) memory batch name (allowed characters: 0..9, a..z, A..Z, space (32 DEC, 20 HEX)) bytes 8-9: (2 bytes 16 bit unsigned integer, MSB first) number of batch processes done for this batch memory. bytes 10-11: (2 bytes 16 bit unsigned integer, MSB first) value of the safety batch timer expressed in tenths of
seconds.
bytes 12-15: (4 bytes 32 bits unsigned long integer, MSB first) batch quantity value expressed in the same units and
with the same decimal digits of the volume counters.
- 18 - RS232_485_ETP_MODBUS_BU_REV02.doc
– Comando per scrivere i dati su una memoria di dosaggio:
Command code: 08 Command format: ADDRESS TO
+ ADDRESS FROM + 08H + 11H (17 DECIMAL) + OPCODE byte, operation code:
bits 0..4 = number of the batch memory to be written (0..15) bit 5 = must be set to one bit 6 = 1 if this batch memory must be set as active batch process, 0 if this batch
memory is to be written only.
bit 7 = must be set to zero
+ 16 bytes of data to be written on the batch memory:
bytes 0-7: (8 bytes ASCII) batch memory name (allowed characters: 0..9, a..z, A..Z, space
(32 DEC, 20 HEX))
bytes 8-9: (2 bytes 16 bit unsigned integer, MSB first) number of batch processes done for
this batch memory.
bytes 10-11: (2 bytes 16 bit unsigned integer, MSB first) value of the batch safety timer
expressed in tenths of seconds.
bytes 12-15: (4 bytes 32 bits unsigned long integer, MSB first) batch quantity value
expressed in the same units and with the same decimal digits of the volume counters.
+ CRC CHECKSUM
Format of the returned data: 16 bytes containing the same batch data for the selected memory sent (if there were any characters or values not allowed, they are corrected to the right values). The data format are the same of the precedent function.
c) - Command for reading the current batch process state:
Command code: 08 Command format: ADDRESS TO
+ ADDRESS FROM + 08H + 01H (1 DECIMAL) + OPCODE byte = 80H (128 DECIMAL)
+ CRC CHECKSUM
Format of the returned data: 1 byte containing the batch process state:
0 = batch process is correctly terminated (pre-set quantity reached). 1 = batch process is running (the valve is opened and the counters are running). 2 = batch process is suspended (the valve is closed before the pre-set quantity is reached).
d) - Command for starting or suspending the current batch process:
Command code: 08 Command format: ADDRESS TO
+ ADDRESS FROM + 08H + 01H (1 DECIMAL) + OPCODE byte = 81H (129 DECIMAL)
+ CRC CHECKSUM
Format of the returned data: 1 byte containing the batch process state as described above.
- 19 - RS232_485_ETP_MODBUS_BU_REV02.doc
e) - Command for resetting the current batch process:
Command code: 08 Command format: ADDRESS TO
+ ADDRESS FROM + 08H + 01H (1 DECIMAL) + OPCODE byte = 82H (130 DECIMAL)
+ CRC CHECKSUM
Format of the returned data: 1 byte containing the batch process state as described above. This command resets the dosing quantity and the safety timer counters.
3.3. ETP PROTOCOL (ENCAPSULATED TRANSFER PROTOCOL)
3.3.1. INTRODUCTION
The ETP is a protocol owner of the converter that has the function of the read and set the parameters of the converter through formatted strings of characters.
3.3.2. DATA WORD FORMAT
The data bytes travelling in serial form on the communication line are enclosed in 10 bits:
1 START BIT 8 DATA BITS = 1 BYTE DI DATI 1 STOP BIT
Each word contains one byte of data plus additional bits which serve to synchronise and make the communication safer. These extra bits are added automatically in the transmission phase by the transmitter integrated circuit. In the reception phase, the reverse operation is executed by the receiver integrated circuit: the eight data bits are extracted and the others are eliminated. These operations are executed entirely on a hardware level. The 8 data bits must be serialised staring from bit 0 (the least significant one).
words
which have a fixed length of
3.3.3. COMMUNICATION SPEED
The millennium series instruments have 4 communication speeds::
4800 bps
9600 bps
19200 bps
38400 bps
- 20 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.3.4. SERIAL PORT SETTINGS FOR RS 232 AND RS 485 PORT
Serial port settings:
Data bits: 8
Parity: none (no parity)
Stop bits: 1
Flow control: none (no control lines no xon/xoff characters used)
3.3.5. GENERAL INPUT SYSNTAX
The information are entered as text line strings, with one or more command-sequences terminated by the <CR> character. The command-sequences are executed in the same order as they are found in the string. The execution of the commands contained in the input string does not start until the <CR> character is received. The optional <LF> character that may follows the <CR> is not considered but it is accepted because usually the Hyper-Terminal or similar application sends also this extra character when the <CR> is sent. As a rule, an input string is composed of one or more command-sequences, terminated by the <CR> character and an optional <LF> character.
The command-sequence is composed by the following elements, exactly in this order:
A five-letter mnemonic command, always present An operator, always present An optional value, present only when requested by the operator type An optional comment-separator, may be present if it is also present the value A comment, present only if it is also present the comment-separator An optional command-separator, present only if another command-sequence follows it
With the exception of the comment element, no other extra characters or spaces are allowed in the command­sequence.
Command: The commands are always represented by a five-letters mnemonic code and are case insensitive, so for example the command MODSV can be written “MODSV”, “Modsv”, “modsv”, “mOdSv” and in any combination of upper / lower case letters.
Operator: The operators permit to choose one of the three possible functions associated to the command at which they are attached and they are:
READ, indicated by the ? symbol. It is used to read values. SET, indicated by the = symbol. It is used to set values. HELP, indicated by the =? sequence of symbols. It is used to display a set of options or a range of permissible values related to the command.
Value: The values can be numbers, strings or special formatted fields like the date / time or the IP addresses, depending on what it is expected by the command. Numeric values are always checked for validity range and strings are checked for length.
- 21 - RS232_485_ETP_MODBUS_BU_REV02.doc
IP addresses and date / time fields are checked only for the correct syntax but not for the values, so please be careful, because in case of misspelled characters or wrong numeric values the result may be different from what it is expected. In case of floating-point numbers, the decimal point symbol to be used is the dot (.), not the comma (,).
Comment-separator: This is an optional element and it is indicated by the “:” symbol.
Comment: This element may be present only when the value to input belongs to a list of options, composed by
numbers and descriptions. Normally the user doesn’t have to supply both, but in case of copying and pasting some values coming from a previously listed configuration, this ensures the full compatibility between the output and the input formats.
Command-separator: This element is required when more than one command-sequence is submitted in an input string and it is indicated with the “,” symbol. For each command-sequence recognized and executed, the converter returns one of the following output types, depending on it:
a result code, when a function execution was requested an expression, when a parameter or a process data value was requested a list of options or a range of values, when an help on a parameter was requested
Each answer is separated from the other by the comma symbol (the same used as command-separator). The complete output string is terminated by a <CR><LF> sequence. Unrecognized command-sequences are silently discarded without response and without halting the execution of the next sequence, if it is present. Illegal parameter’s values and operations performed in wrong contexts are reported and identified by error codes.
Result-code: The format of the results is the following: code-number:description, without any blank spaces separating the number from the description.
There are six possible result-codes:
0:OK, the execution was correct 1:CMD ERR, wrong context, execution was not possible due to a configuration limit or wrong working conditions 2:PARAM ERR, the expected parameter was out of the allowed range 3:EXEC ERR, the execution of the command was not successful due to an internal error condition 4:RANGE ADJ, the entered parameter caused an internal automatic adjustment on other ranges 5:ACCESS ERR, the execution of the command was not possible due to an insufficient privilege level 6:BUFFER FULL, the input or the output strings exceed the maximum allowable space.
3.3.6. SPECIAL CHARACTERS
The following characters have special meaning in the protocol and thus they can’t be used for other purposes:
<CR> carriage-return character, value 13 decimal, 0D hexadecimal, terminates the input string and starts the elaboration <LF> line-feed character, value 10 decimal, 0A hexadecimal, may follows the <CR> but it is never considered ? question mark character, value 63 decimal, 3F hexadecimal, it is an operator character = equal sign character, value 61 decimal, 3D hexadecimal, it is another operator character : colon character, value 58 decimal, 3A hexadecimal, it is the comment-separator character , comma character, value 44 decimal, 2C hexadecimal, it is the command-separator character
3.3.7. ACCESS CODE FOR FUNCTION WITH PRIVILEGE LEVEL
The access and the changing of some parameters can made only after the inserting of a level code. This can made sending an access code corresponding to the level L2 as first command before inserting the command.
- 22 - RS232_485_ETP_MODBUS_BU_REV02.doc
The syntax for inserting the code is: “ACODE=n” with n=access code L2 The lifecycle of the code is limited at the execution of the string command that following the code. After the acquisition of the command the access level return at default status. Is necessary to insert the code level every time the command or the list of the command request the insertion of the code access greater than the default level. If the level L2 of the converter is set to 0, then is not necessary to insert the code L2. When the access code is not sufficient for the command, the converter return the following error code:
5:ACCESS ERR
Example of string with command for code level L2=12345 and command for reading model a software version of the converter:
“ACODE=12345,MODSV?” + chr(13)
3.3.8. DATA BLOCK FORMAT
Communication takes place through data blocks or packs of variable length which do not exceed 256 bytes overall. A data block or pack is composed thus::
ADDRESS TO, Containing the address of the device the block is sent to; ADDRESS FROM, Containing the address of the device which sent the block; BLOCK CODE, Containing the code that it indicates if after this block given there is a successive block; BLOCK LENGTH, Containing the length of the data block in bytes BLOCK DATA, The block of data of variable length from zero to 250 bytes CRC CHECKSUM BYTE, Calculated in the following way:
4. CRC initialised to zero
5. CRC rotated to the left by one bit
6. CRC = CRC + block bytes
The process is repeated starting from point 2. for all the block bytes, excluding CRC..
NOTE:
The CRC must be subjected to an operation of
The difference is shown in the following example:
byte value: 10100010 shifting : 1 <= 0100010 <= 0 rotating: 1 1 <= 0100010 <= 1
NOTE:
The code to insert in BLOCK CODE can have the following values:
91 decimal (5B hex) Insert 90 decimal when BLOCK DATA length is smaller or equal to 250 characters
If the length of the block data is greater than 250 characters, split the block data in packets of 250
Every packets with BLOCK DATA of 250 characters have BLOCK CODE equal to 91 dec.
The last block of data with numbers of byte smaller or equal to 250 have BLOCK CODE with 90 dec.
90 decimal (5A hex)
characters.
rotation to the left
and not just a simple
shift
operation.
- 23 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.3.9. EXAMPLE OF ETP COMAND
Reading model and software version of the converter:
mnemonic: MODSV
syntax of the command: “MODSV?”
list of the bytes and corresponding values of the command:
byte 0: address to = chr(0) byte 1: address from = chr(170) byte 2: block code = chr(90) (length of the next data block smaller than 250 characters) byte 3: length = chr(7) (length of the next data block) byte 4: block data = chr(77) = ‘M’ byte 5: block data = chr(79) = ‘O’ byte 6: block data = chr(68) = ‘D’ byte 7: block data = chr(83) = ‘S’ byte 8: block data = chr(86) = ‘V’ byte 9: block data = chr(63) = ‘?’ byte 10: carriage-return <CR> = chr(13) byte 11: checksum = chr(239)
List of the bytes to send to the converter in hexadecimal format:
chr(0x00) + chr(0xAA) + chr(0x5A) + chr(0x08) + chr(0x4D) + chr(0x4F) + chr(0x44) + chr(0x53) + chr(0x56) + chr(0x3F) + chr(0x0D) + chr(0xEF)
3.3.10. EXAMPLE OF RESPONSE FOR PRECECDENT ETP COMAND
Header string response:
byte 0 = chr(170) byte 1 = chr(0) byte 2 = chr(218) 218 dec = 0xDA hex (code 218 = length of the next data block smaller than 250 characters) byte 3 = chr(29) number of characters of the data block = 29 bytes
Body string response:
byte 4 = 77 chr(77) = ‘M’ char 1 byte 5 = 76 chr(76) = ‘L’ char 2 byte 6 = 32 chr(32) = ‘ ’ char 3 byte 7 = 50 chr(50) = ‘2’ char 4 byte 8 = 49 chr(49) = ‘1’ char 5 byte 9 = 48 chr(48) = ‘0’ char 6 byte 10 = 32 chr(32) = ‘ ’ char 7 byte 11 = 86 chr(86) = ‘V’ char 8 byte 12 = 69 chr(69) = ‘E’ char 9 byte 13 = 82 chr(82) = ‘R’ char 10 byte 14 = 46 chr(46) = ‘.’ char 11 byte 15 = 51 chr(51) = ‘3’ char 12 byte 16 = 46 chr(46) = ‘.’ char 13 byte 17 = 54 chr(54) = ‘6’ char 14 byte 18 = 48 chr(48) = ‘0’ char 15 byte 19 = 32 chr(32) = ‘ ’ char 16 byte 20 = 77 chr(77) = ‘M’ char 17 byte 21 = 97 chr(97) = ‘a’ char 18 byte 22 = 121 chr(121) = ‘y’ char 19
- 24 - RS232_485_ETP_MODBUS_BU_REV02.doc
byte 23 = 32 chr(32) = ‘ ’ char 20 byte 24 = 49 chr(49) = ‘1’ char 21 byte 25 = 53 chr(53) = ‘5’ char 22 byte 26 = 32 chr(32) = ‘ ’ char 23 byte 27 = 50 chr(50) = ‘2’ char 24 byte 28 = 48 chr(48) = ‘0’ char 25 byte 29 = 48 chr(48) = ‘0’ char 26 byte 30 = 55 chr(55) = ‘7’ char 27 byte 31 = 13 chr(13) = char 28 byte 32 = 10 chr(10) = char 29
byte 33 = 247 checksu
3.3.11. COMUNICATION
The above mentioned communication protocol is used to exchange data between one unit defined as the MASTER and another unit defined as the SLAVE.
The term MASTER is used here to indicate a device capable of initiating data transmission on its own initiative.
The term SLAVE however, is used to indicate a device capable of transmitting data only in reply to a command received.
Neither of the two types of devices can receive and transmit contemporaneously: these operations take place in two different time phases.
Two MASTER type units cannot be connected together because both of the devices would begin to transmit autonomously and would never succeed in synchronizing themselves.
Analogously, two SLAVE type devices could never exchange information because neither of the two is capable of initiating communication on its own initiative.
The flow of information in both directions therefore takes place alternately using blocks containing a maximum of 95 words each. A word is composed of 10 bits in all: 1 start bit + 8 data bits + 1 stop bit.
These data blocks are received contemporaneously by all the devices connected along the communication line, but only the device with the address equal to the one contained in the data block will be the real destined.
The words comprising the block must be sent on the serial line in a continuous mode, without dead time between one word and the next. The maximum dead time permitted between two words must not exceed the duration of one word.
SLAVE type devices always generate a reply to every message sent to them and correctly received. In the case of reception errors, there is no reply. In the case of command interpretation errors (incorrect format, missing parameters, etc.) either a block without data or no reply, may be the reply depending on the case.
The that elapses between the sending of the last data word by the MASTER and the sending of the first reply word by the SLAVE can be schematized as follows:
last word transmitted by the MASTER | | reply processing: time variable from 0 to 25 milliseconds at the most | | | | time equal to 3 complete words | | | | | | first word transmitted by the SLAVE as reply | | | |
.....xxxxx| t0 | t1 |xxxxxx......
- 25 - RS232_485_ETP_MODBUS_BU_REV02.doc
Time t0 depends on the type of command sent and the type of converter it is sent to. Time t1 depends on the communication speed used. A further time t2 - equal to the word length - must be added to these two times. The integrated circuit receiver needs this time to acquire and extract the data bytes of the first word received.
For the system to work correctly, a MASTER type device must respect the following protocol:
1. block transmission with the code-command;
2. wait for the first reply word for a period of time slightly longer than t0 max. + t1 + t2;
3. reception of the rest of the reply block if arrived or the re-transmission of the block with the code - command. After a certain number of re-transmissions without reply, an error message may be generated.
The SLAVE reply must always be waited for within a certain time limit (timeout), once this time has elapsed a new block can be transmitted. If the wait time is too short, a fresh MASTER transmission may take place during the same time the SLAVE is replying, with the consequent loss of both data blocks.
If the wait time is excessive, the system could become too slow in signalling faults, especially if there are many instruments connected in the network.
In any case, a timer must be used to indicate the time limit because reply from the SLAVE cannot be trusted with certainty: in fact, this latter cannot reply in the case of line errors.
If the communication speed is 9600 bps and the format is 10 bits, the length of a word is equal to 1.042 ms. A reasonable time limit could be calculated thus:
T
= t0 max. + t1 + t2 + 1 ms = 25 + 3 x 1.042 + 1 x 1,042 + 1 = 30.17 ms.
lim
IMPORTANT NOTES: There must be a «silence» interval, equal to at least 3 complete words (30 bits), between each data
block and the successive one in transit on the serial line.Before starting transmission, to the network, activate the transmitter for a time of no less than 3 words (30 bits) and then begin to send the output characters. This is to give the devices in the network time to eliminate any false characters received when the network was not in use status.
3.3.12. SUGGESTIONS FOR RS485 INTERFACE USE
When programs are developed which use this type of interface, it is as well to make a few considerations. Firstly, we should remember that data transits both in reception and in transmission on the RS485 and that when no transmitter is enabled, the line is in a condition of relatively high impedance. Physically the RS485 interface is created by a transmitter with a differential output and by a receiver, also with a differential input. The output of the first is physically connected to the input of the second, according to the scheme shown below:
TRANS. ENABLING
TRANS INPUT REC. OUTPUT
From this scheme we can see how the transmission and reception of different data simultaneously is not possible. Each function must be activated separately with a specific software command which changes the logical status of an
- 26 - RS232_485_ETP_MODBUS_BU_REV02.doc
+
-
+
-
RS485 LINE
interface pin (the transmitter enabling signal). This is the main difference with respect to the RS232 interface normally present on PCs.
In fact, whilst with the RS232 we do not have to worry about the data traffic because it travels on two separate lines (RXD and TXD), with the RS485 there is only one line with the traffic suitably managed.
The first operation we must do therefore is to activate the transmitter and then send all the data to the communication port. Next, we have to wait until the last piece of data has gone from the port to the line and only at this point can we disables the transmitter.
The management software must also absolutely prevent two different devices on the same line from being activated for transmission at the same time: this would mean that we would have the outputs of the drivers of the two transmitters connected in parallel, with a consequent overheating of the components and a loss of information. This eventuality would not break the devices however as they are thermally protected.
On this matter it is necessary to pay extreme attention to the delay between the transmission of the last data byte (the checksum) and the effective disabling of the transmitter. This delay must be lower than the time equivalent for transmitting a 10 bit word, because after this time has elapsed, the device addressed will begin its transmission phase.
For the converter with software version 3.50 or greater, in the menu Communication is present the function A.delay.
This setting value in milliseconds, have the function to insert a delay interval for the response from the converter, so that the transmitter device have enough time to switch in receiver status.
It is also necessary to note that when the line is not piloted by any transmitter, it is in a condition of relatively high impedance and this may give rise to the reception of characters without the right meaning and possible disturbance. On this question, the communication management software must activate the transmitter a few seconds before transmission starts (typically a time of no less than the length of 3 words at the speed used) so as not to give the line a defined logical status (MARK) and to permit the receivers connected to eliminate any false characters. In the same way, during reception, it must take any such characters possibly present during line inactivity and rapidly eliminate them to prevent saturation of the reception buffers, especially so at high speeds
Furthermore, given that the receiver is anyway connected to the transmitter output, in some types of interface it is necessary to eliminate any characters possibly present, received during the transmission phase, because they are copies of what has just been sent. See the next section for some programming examples.
- 27 - RS232_485_ETP_MODBUS_BU_REV02.doc
3.3.13. FLOW CHART FOR SENDING ETP COMMAND AND RECEPTION OF THE ANSWER
Flow chart with description of the sending of an ETP command to a converter through the RS 485 port and wait cycle for the reception of the answer
The MASTER generates ETP command
The MASTER enables the transmitter
The MASTER send ETP command to the addressed SLAVE
The MASTER enable receiver - Start timer T
Packet with addresses
for other device Packet deleted
T
Reset timer
lim
No
No
No
The MASTER decode the Header answer
START
Timer T
Has it received char ?
Start timer char
Timer char expired ?
Has it received char ?
Reset timer cha r
Has received 4 bytes ?
expired ?
lim
No
Si
No
Si
Si
Si
Si
The Timer has expired
Answer not received
END
- 28 - RS232_485_ETP_MODBUS_BU_REV02.doc
Another block to
receive
Note:
The timer char is set to 2.5 time the time necessary for to receive a char: 2.5 * tchar. Every time there is a char in the receive buffer the timer char is restart. If the receive buffer doesn’t receive a char in the next 2.5 * tchar, the timer char expire and the reception of data is terminated.
- 29 - RS232_485_ETP_MODBUS_BU_REV02.doc
No
The address are ok ?
Si
The MASTER read the BLOCK CODE and BLOCK LENGHT
Timer char expired ?
No
Has it received char ?
Reset timer cha r
No
Has the MASTER received
BLOCK LENGHT chars ?
The checksum is ok ?
Decoding of the answer with success
No
Is the Block code = 0xDA ?
Is this the last block
Block code = 0xDA
This is the last block
Reception completed
No
Si
Si
Si
Si
END
Si
No
Packet not
complete
Bad Checksum
Packet corrupted
3.3.14. LIST OF SUPPORTED COMMANDS GROUPED SIMILARLY TO THE INTERNAL MENU
SYSTEM
NOTE ( VALID FOR ALL FUNCTIONS ) : returned value 5 = ACCESS ERR ( insufficient access
level )
COMMANDS AND FUNCTIONS EQUIVALENT TO THE “1-SENSOR” MENU
Name and description Modes Returned values or codes
PDIMV (Pipe DIaMeter Value)
Reads or sets the nominal diameter of the sensor.
CFFKA (CoeFFicient KA) Reads or
sets the value of the gain coefficient KA
SMODL (Sensor MODeL) Reads or
sets the value of the sensor model
SIPOS (Sensor Insertion POSition)
Reads or sets the value that identifies the insertion position for that type of sensor
CKLP0, CKLP1, CKLP2, CKLP3, CKLP4, CKLP5 (Coefficient KL Positive 0, 1, 2, 3, 4 an 5) Reads
- 30 - RS232_485_ETP_MODBUS_BU_REV02.doc
Read command: PDIMV?
Set command: PDIMV=
Help command: PDIMV=?
Read command: CFFKA?
Set command: CFFKA=
Help command: CFFKA=?
Read command: SMODL?
Set command: SMODL=
Help command: SMODL=?
Read command: SIPOS?
Set command: SIPOS=
Help command: SIPOS=?
Read command: CKLP0?
value of nominal diameter if accepted
5:ACCESS ERR if insufficient access
level
0:OK if parameters accepted
n
2:PARAM ERR if 5:ACCESS ERR if insufficient access
level
min <> max (unit)
5:ACCESS ERR if insufficient access
level Value of the coefficient if accepted
5:ACCESS ERR if insufficient access
level
0:OK if parameters accepted
n
2:PARAM ERR if 5:ACCESS ERR if insufficient access
level
min <> max
5:ACCESS ERR if insufficient access
level Value of the sensor model if accepted
5:ACCESS ERR if insufficient access
level
5:ACCESS ERR if insufficient access
level
0:OK if parameters accepted
n
2:PARAM ERR if 5:ACCESS ERR if insufficient access
level
min <> max
5:ACCESS ERR if insufficient access
level Value of the insertion position if accepted
5:ACCESS ERR if insufficient access
level
n
0:OK if parameters accepted 2:PARAM ERR if 5:ACCESS ERR if insufficient access
level
min <> max
5:ACCESS ERR if insufficient access
level Value of the coefficient if accepted
5:ACCESS ERR if insufficient access
level
n
out of range
if accepted
n
out of range
if accepted
n
out of range
if accepted
n
out of range
if accepted
Loading...
+ 74 hidden pages