SE 56 RS232 SERIAL PORT RS485 SERIAL PORT ETP and MODBUS PROTOCOL APPLICATION NOTE EDITION APRIL 2008 RS232_485_ETP_MODBUS_BU_REV02.
INDEX 1. THE HARDWARE CONNECTION WITH THE CONVERTER...................................................................................4 1.1. ML XXX................................................................................................................................................................................4 1.2. ML XXX................................................................................................................................................................................
4.3. HTP PROTOCOL...............................................................................................................................................................68 5. MODBUS FIELD BUS ..................................................................................................................................................71 5.1. INTRODUCTION ..................................................................................................................................................
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.
3. DPP (DATA PACKET PROTOCOL) 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.
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.
3.2.6. COMMAND FORMATS A command is defined as an operating code of 1 byte specifying the type of operation required. The reply to this 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 0 1 2 3 4,5,6,7,9, 10,13 8 11 12 14 Action performed by the measuring device after receiving the command.
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).
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.
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.
byte 2: bit bit bit bit bit bit bit bit 0 1 2 3 4 5 6 7 =1 =1 =1 =1 =1 =1 =1 =1 if if if if if if if if the the the the the the the the maximum alarm for the thermal power is active minimum alarm for the thermal power is active maximum alarm for the delta T is active minimum alarm for the delta T is active maximum alarm for the temperature T1 is active minimum alarm for the temperature T1 is active maximum alarm for the temperature T2 is active minimum alarm for the temperature T2 is active byte 45:
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.
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 Flow rate in % Full scale flow rate Flow rate in technical units Measure unit for the flow rate Measure unit for the volume totalizers Number of decimal digit after the point for volume tot
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 bit 1 bit 2 bit 3 bit 4 bit 5 bit 6 bit 7 =1 if the excitation is too fast for the sensor connected =1 if the maximum alarm is active =1 if the minimum alarm is active =1 if the flow rate exceeds the scale range value (overflow) =1 if one or more output impulses are saturated (too many impulses to emit) =1 if the mea
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.
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. specifying the address (byte 0), the data logger is cancelled. If we request memory, the returned data has no sense.
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. specifying the address (byte 0), the data logger is cancelled. If we request memory, the returned data has no sense. For this purpose we recommend to check the number of records present in the memory which is returned by If we assign the value AAH to the byte the address of a record not present in the starting from the request for record 0 and the measuring device..
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-011992, 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.
– 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.
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.
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 character. The command-sequences are executed in the same order as they are found in the string.
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.
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.
3.3.9.
byte byte byte byte byte byte byte byte byte byte 23 24 25 26 27 28 29 30 31 32 = = = = = = = = = = 32 49 53 32 50 48 48 55 13 10 byte 33 = 247 chr(32) chr(49) chr(53) chr(32) chr(50) chr(48) chr(48) chr(55) chr(13) chr(10) = = = = = = = = = = ‘’ ‘1’ ‘5’ ‘’ ‘2’ ‘0’ ‘0’ ‘7’ char char char char char char char char char char 20 21 22 23 24 25 26 27 28 29 checksu 3.3.11.
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. 2. 3.
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.
3.3.13.
No The address are ok ? Si The MASTER read the BLOCK CODE and BLOCK LENGHT Si Timer char expired ? Packet not complete No No Has it received char ? Si Reset timer char No Has the MASTER received BLOCK LENGHT chars ? Si No The checksum is ok ? Si Decoding of the answer with success Another block to receive Bad Checksum Packet corrupted No Is the Block code = 0xDA ? Is this the last block Si Block code = 0xDA This is the last block Reception completed END Note: The timer char is set to 2.
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 PDIMV (Pipe DIaMeter Value) Read command: PDIMV? Reads or sets the nominal diameter of the sensor.
or sets the value for the six Set command: CKLP0=n coefficients for the linearization of the positive flow rate range. NOTE: the examples refer to the command CKLP0, but the others Help command: CKLP0=? are the same CKLN0, CKLN1, CKLN2, CKLN3, Read command: CKLN0? CKLN4, CKLN5 (Coefficient KL Negative 0, 1, 2, 3, 4 an 5) Reads or sets the value for the six Set command: CKLN0=n coefficients for the linearization of the negative flow rate range.
EPDCC (Empty Pipe Detection Read command: NOT Calibration Command) Executes the SUPPORTED calibration of the empty pipe detection circuit. Set command: EPDCC=1 Help command: EPDCC=? 1:CMD ERR if read command is issued 5:ACCESS ERR if insufficient access level 0:OK if execution ok 2:PARAM ERR if parameter not equal to 1 1:EXECUTE if accepted SZPCC (Sensor Zero Point Read command: SZPCC? Calibration Command) Executes the calibration of the sensor zero point.
FRFS1 (Flow Rate Full Scale 1) Read command: FRFS1? Reads or sets the value of flow rate full scale 1. Set command: FRFS1=n Help command: FRFS1=? FRFS2 (Flow Rate Full Scale 2) Reads or sets the value of flow rate Read command: FRFS2? full scale 2. Set command: FRFS2=n Help command: FRFS2=? VTMUT (Volume Totalizer Measure Unit Type) Reads or sets the type of measure units relative to the totalizers.
CH1PV (CHannel 1 Pulse Value) Reads or sets the value representing the volume of one totalization pulse for the channel 1. Read command: CH1PV? Set command: CH1PV=n Help command: CH1PV=? CH2PV (CHannel 2 Pulse Value) Reads or sets the value representing the volume of one totalization pulse for the channel 2. Read command: CH2PV? Set command: CH2PV=n Help command: CH2PV=? CH1PT (CHannel 1 Pulse Time) Reads or sets the value representing the time duration pulse for the channel 1.
Set command: VMSGK=n Help command: VMSGK=? A1CSY (Analog input 1 Custom SYmbol) Reads or sets the value representing the custom measure unit used for the analog input 1. If the values is to be set, a fixed 3characters length string must be supplied. Read command: A1CSY? Set command: 1CSY=string Help command: A1CSY=? A1MUV (Analog input 1 Measure Unit Value) Reads or sets the value of measure units relative to the totalizers.
min <> max (units) if accepted Help command: A1SSV=? A1FSV (Analog input 1 Full Scale Value) Reads or sets the value of the full scale point for the analog input 1. Read command: A1FSV? Set command: A1FSV=n Help command: A1FSV=? 1:CMD ERR if analog input 1 not enabled 5:ACCESS ERR if insufficient access level Full scale value of analog in.
MFCUT (Measure Filter Cut-off Threshold) Reads or sets the value of the measure filter cut-off threshold. ACALE (Auto-CALibration Enable) Enables or disables the autocalibration feature of the instrument. ARNGE (Auto-RaNGe Enable) Enables or disables the auto-range feature of the instrument. ENSVE (ENergy-SaVing Enable) Enables or disables the energysaving feature of the instrument.
COMMANDS AND FUNCTIONS EQUIVALENT TO THE “4-ALARMS” MENU Name and description FRAXP (Flow Rate Alarm maX Positive threshold) Reads or sets the value of the maximum positive flow rate alarm threshold. Modes Read command: FRAXP? Set command: FRAXP=n Help command: FRAXP=? FRAXN (Flow Rate Alarm maX Negative threshold) Reads or sets the value of the maximum positive flow rate alarm threshold.
EPDAT (Empty Pipe Detection Alarm Threshold) Reads or sets the value of the alarm threshold for the empty pipe detection system. Read command: EPDAT? Set command: EPDAT=n Help command: EPDAT=? OCACV (Output Current Alarm Condition Value) Reads or sets the value of the alarm value at which the current output will be set in case of error conditions. Valid only if the current output is installed and enabled.
on the digital input. Valid only if the digital input is installed and enabled. Set command: VTPPE=n Help command: VTPPE=? VTTNE (Volume Totalizer Total Negative reset Enable) Enables or disables the consent for resetting the total negative volume totalizer when receiving an external signal on the digital input. Valid only if the digital input is installed and enabled.
Help command: TCLIE=? CALIE (CALibration Input Enable) Enables or disables the consent for calibrating when receiving an external signal on the digital input. Valid only if the digital input is installed and enabled. Read command: CALIE? Set command: CALIE=n Help command: CALIE=? SRCIE (Scale Range Change Input Enable) Enables or disables the consent for changing the scale range when receiving an external signal on the digital input. Valid only if the digital input is installed and enabled.
Name and description OUT1F (OUTput 1 Function) Sets the function type related to the digital output 1. Valid only if the digital outputs are installed and enabled. Modes Read command: OUT1F? Set command: OUT1F=n Help command: OUT1F=? OUT2F (OUTput 2 Function) Sets the function type related to the digital output 2. Valid only if the digital outputs are installed and enabled.
Set command: CO1FS=n Help command: CO1FS=? CO1SS (Current Output 1 Start Scale) Sets the start scale value for the current output 1: it can be 0 or 4 mA. Valid only if the current output1 is installed and enabled. Read command: CO1SS? Set command: CO1SS=n Help command: CO1SS=? CO1FM (Current Output 1 Field Mode) Sets the field mode value for the current output 1: it can be +, -, +/-, –0+. Valid only if the current output1 is installed and enabled.
Help command: IF2PT=? DVADR (DeVice ADdRess) Reads Read command: DVADR? or sets the device address. Valid only if the RS232 port is installed and enabled. Set command: DVADR=n Help command: DVADR=? 232SP (rs232 SPeed) Reads or Read command: 232SP? sets the RS232 speed in bps. Valid only if the RS232 port is installed and enabled. Set command: 232SP=n Help command: 232SP=? 232PT (rs232 Protocol Type) Read command: 232PT? Reads or sets the protocol type for the RS232 port: it can be DPP or HTP.
Set command: SPDSE =n SPDSC (Sms Process Data Send Command) send a command for immediately answer with process data ROAME (ROAMing Enable) Enable or disable roaming function SCAPE (SCADA Protocol Enable) Enable or disable SCADA protocol GSITM (Gsm Inactivity TiMeout) timeout for inactivity connection DTSDL (DaTa Send DeLay) delay for send data 0:OK if parameters accepted 2:PARAM ERR if n out of range 5:ACCESS ERR if insufficient access level Help command: SPDSE =? List of num:description if accepted 5
GSCLN (GSm CaLl Number) Read command: GSCLN? telephone number for GSM connection Set command: GSCLN =n Help command: GSCLN =? 485PT (RS485 Protocol Type) Read command: 485PT? Reads or sets the protocol type for the RS485 port: it can be DPP, HTP or MODBUS.
Help command: VTTPR=? VTPPR (Volume Totalizer Partial Positive Reset) Resets the partial positive volume totalizer. VTTNR (Volume Totalizer Total Negative Reset) Resets the total negative volume totalizer. VTPNR (Volume Totalizer Partial Negative Reset) Resets the partial negative volume totalizer. ENSDT (ENergy Saving Display Time) Reads or sets the value of the display on time used in the energy saving mode. This time is also used to wait for the incoming of new sms if they are enabled.
TTNVE (TOTalizers Net Value Read command: TTNVE? Enable) enable disable the visualization of Net totalizer Set command: TTNVE =n TCMDE (Totalizers Currency Mode Display Enable) Enables or disables the displaying of the currency values for the totalizers. CUSYT (CUrrency SYmbol Type) Reads or sets the type of currency symbol used to represent the values converted from the totalizers. CUCSS (CUrrency CuStom Symbol) Reads or sets the custom symbol used to represent the currency.
converted to currency. Set command: CUDEC=n Help command: CUDEC=? CUPCF (CUrrency Positive Conversion Factor) Reads or sets the value of the conversion factor coefficient used to convert the partial positive totalizer to currency. Read command: CUPCF? Set command: CUPCF=n Help command: CUPCF=? CUNCF (CUrrency Negative Conversion Factor) Reads or sets the value of the conversion factor coefficient used to convert the partial negative totalizer to currency.
DLGSI (Data LoGger Sample Interval) Reads or sets the sample time interval at which the data are collected. Read command: DLGSI? Set command: DLGSI=n Help command: DLGSI=? DTIME (Date / TIME) Reads or sets the date and time value. WARNING: when setting the date and time, always check the value returned because malformed input string may lead to incorrect time result.
Help command: DLDRE=? DLDSE (Data Logger static Data Send Enable) Enables or disables the sending of the static data logger’s data by email using the GPRS terminal. DLYRD (Data Logger dYnamic ReaD) Reads the specified record, the number of records saved in the dynamic data logger or the maximum number of records that can be saved in memory. DLYRE (Data Logger dYnamic REset) Resets the dynamic data logger and clears all records.
List of num:description if accepted 1:CMD ERR if RS232 port not enabled 5:ACCESS ERR if insufficient access level Read number of records: Number of records in memory if DLERD? accepted 1:CMD ERR if logging functions not enabled Read record: DLERD=n Record n in CSV format if accepted 1:CMD ERR if logging functions not enabled 2:PARAM ERR if n out of range Read max capacity: Maximum range of n for the memory in the format min <> max if DLERD=? accepted 1:CMD ERR if logging functions not enabled Read command:
Help command: DLMRE=? DLUSE (Data Logger measure Units Send Enable) Enables or disables the sending of the measure units of the loggers data by email using the GPRS terminal. Not enabling this option makes the data more compact to send by wireless communication. DLTST (Data Logger Test Start Time) Reads or sets the date and time start value used for the “step check” test.
Set command: DLTTI=n Help command: DLTTI=? DTSON (Data logger Test Start ON) Starts the “step check” test mode and reads the status of the operation (1 = in progress , 0 = terminated). If the stop date is less than the current time and date, an error code is returned Read command: DTSON? Set command: DTSON=1 Help command: DTSON=? DTSOF (Data logger Test Start OFf) Stops or suspend the “step check” test mode.
Set command: MSIEN=n Help command: MSIEN=? STBYC (STandBY Command) set Read command: STBYC =? converter in stand-by mode Once this command is issued , the only way to wakeup the Set command: STBYC =n converter is by the keyboard 0:OK if parameters accepted 2:PARAM ERR if n out of range 5:ACCESS ERR if insufficient access level List of num:description if accepted 5:ACCESS ERR if insufficient access level List of num:description if accepted 5:ACCESS ERR if insufficient access level 0:OK if parameters accept
Help command: SUDIC=? SFDIC (Save Factory Defaults Read command: NOT Immediate Command) Saves the SUPPORTED current working parameters as Help command: SFDIC=? factory defaults preset data. CMRIC (Complete Memory Reset Immediate Command) Resets all the working parameters to the default values. WARNING: all the current working parameters eventually modified by the user and the calibration coefficients will be lost! SRNUM (SeRial NUMber) Reads the device serial number.
CFFKZ (CoeFFicient KZ) Reads or Read command: CFFKZ? sets the value of the zero coefficient KZ Help command: CFFKZ=? ICALE (Ignore CALibration Errors) Read command: ICALE? Enables or disables the calibration errors recognition. Set command: ICALE=n Help command: ICALE=? C1CP1 (Current output 1 Read command: C1CP1? Calibration Point 1) Reads or sets the value of the current output calibration point 1 (4 mA).
Help command: A1CP2=? Required access level: 2 min <> max if accepted 1:CMD ERR if analog input not enabled 5:ACCESS ERR if insufficient access level COMMANDS AND FUNCTIONS USED FOR READING THE PROCESS PARAMETERS Name and description FRSRN (Flow Rate Scale Range Number) Reads the scale range currently in use on the instrument. Valid only if the dual-range function is active. FRVPC (Flow Rate Value PerCent) Reads or sets the flow rate value in the percent form.
its technical measure unit. Returns two comma-separated fields, the technical unit symbol and the numeric value. CUTPV (CUrrency Totalizer Positive Value) Reads the converted currency value relative to the partial positive totalizer and its currency unit. Returns two comma-separated fields, the unit symbol and the numeric value. CUTNV (CUrrency Totalizer Negative Value) Reads the converted currency value relative to the partial negative totalizer and its currency unit.
CFLST (Configuration LiST) Read command: CFLST? The list command if command accepted 1:CMD ERR if GPRS not enabled 5:ACCESS ERR if insufficient access level COMMANDS AND FUNCTIONS SPECIFIC TO GPRS COMMUNICATION Name and description GPAPN (GPrs Access Point Name) Reads or sets the GPRS network access point name. This parameter must be set accordingly to what is specified by the wireless operator and it is a string of max. 31 characters length.
Help command: GPEMT=? GPURL (GPrs URL) Reads or sets the GPRS network URL used to fetch the dynamic document in the http server that performs the time synchronization. The trailing “/” preceding the URL and the eventual “http://” must be omitted. The maximum length is 31 characters. Read command: GPURL? GPASN (GPrs Authorized Sender Number) Reads or sets the GPRS network SMS authorized number from which the device can accept SMS commands.
using the GPRS terminal. GPESI (GPrs Email Send Interval) Reads or sets the value of the time interval used to send the emails. GPSCI (GPrs Sms Check Interval) Reads or sets the value of the time interval used to check the sms. GPCSE (GPrs Clock Sync Enable) Enables or disables the synchronization of the clock using the GPRS terminal. GPSMP (GPrs SMtp Port) Reads or sets the GPRS network SMTP port used to exchange the email data. Usually is the TCP port 25.
Help command: GPHTP=? GPSMA (GPrs SMtp Address) Reads or sets the GPRS network SMTP server address used to exchange the email data. It must be specified in the IP-range notation. Read command: GPSMA? Set command: GPSMA=ip-range Help command: GPSMA=? GPHTA (GPrs HTtp Address) Reads or sets the GPRS network HTTP server address used to exchange the clock synchronization data. It must be specified in the IP-range notation.
3.3.15.
DLERE, data logger event reset DLESE, data logger event send enable DLGSI, data logger sample interval DLMRD, data logger min/max read DLMRE, data logger min-max reset DLOGE, data logger enable DLTPT, data logger test stop time DLTST, data logger test start time DLTTI, data logger test time interval DLUSE, data logger measure units send enable DLYRD, data logger dynamic data read DLYRE, data logger dynamic data reset DLYSE, data logger dynamic data send enable DTIME, date / time DTSDL, DaTa Send DeLay DTSOF
IF2PT, IF2 protocol type L2ACD, level 2 access code LFDIC, load factory defaults immediate command LLANG, layout language LUDIC, load user data immediate command MFCUT, measure filter cut-off threshold MFMXT, measure filter max variation threshold MFSKT, measure filter skip threshold MFTCV, measure filter time constant value MODBP, MODBus Parity MODSV, MODel and Software Version MSIEN, measure simulation enable OCACV, output current alarm condition value OUT1F, output 1 function OUT2F, output 2 function PD
4. HTP PROTOCOL (HYPER TEXT PROTOCOL) 4.1. INTRODUCTION HTP protocol is a set of command used only with the RS 232 serial port of the converter. A standard application suitable for this purpose is the Windows program “HyperTerminal”. 4.2. DESCRIPTION AND USE Connect the flow meter to the PC with the IF21 cable. On the flow meter, set the function “IF2 prot.= HTP” on the menu “7-Communication”.
• • • • • • • Save the modified file and close the Notepad application. Send the following command to the instrument: “ACODE=xxxxx,L2ACD=0”, where the xxxxx stays for the actual L2 code set in the instrument. This disables the Level 2 code, otherwise it should be necessary to repeat the command “ACODE=xxxxx” at each line.
General input syntax. The information are entered in the flow meter as text line strings, with one or more command-sequences terminated by the 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 character is received.
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 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.
5. MODBUS FIELD BUS 5.1. INTRODUCTION In this section of the manual there is the description of the Modbus field bus implemented in the converter. The Modbus field bus is available in the RS232 and RS485 serial port of the converter. 5.2. RS485 HARDWARE CONNECTION For the hardware connection see the relative section in this manual. 5.3.
5.6. PARAMETER SETTINGS MODBUS PARAMETERS SETTINGS FOR THE CONVERTER: • • • Menu «7-Communication», function - «Parity»: set the control of the parity for the byte frame in MODBUS communication. This function affect all the serial port that communicate with MODBUS protocol. The possible value are: EVEN (default), NONE and ODD. Menu «7-Communication», function - «RS485 pr.»: the function select protocol type for the RS 485 serial port. Select the value MODBUS. Menu «7-Communication», function - «RS232 pr.
Addresses(Hex format) 0000-0001 0002-0003 0004-0005 Description Flow rate in % (float) Flow rate in technical unit (float) Totalizer for total volume positive T+ (V+ for ML211) (long) Totalizer for partial volume positive P+ (V- for ML211) (long) Totalizer for total volume negative T- (E+ for ML211) (long) Totalizer for partial volume negative P- (E- for ML211) (long) Clock value in seconds (long) Input value AIN1 in technical unit (opt.) (float) Input value AIN2 in technical unit (opt.
Bit Bit Bit Bit Bit 3 4 5 6 7 = = = = = min alarm delta T max alarm temp. T1 min alarm temp. T1 max alarm temp. T2 min alarm temp. T2 (bit 8-15 not used, value = 0) 0025 Flags ML212: Bit Bit Bit Bit Bit Bit 0 1 2 3 4 5 (LSB) = command error actuator = deviation error = Input error AIN1 = Input error AIN2 = manual regulation active = safety mode active (bit 6-15 not used, value = 0) Data Logger values Addresses(Hex format) 0064-0077 0078-008B … … … 02D0-02E3 Description Data block record n.
0076-0077 Temperature value T2 in technical unit (float) (ML211) The returned values are at FFFFFFFF (hex) when the request data is not valid in the data logger (data not still collected). Data Logger events Addresses(Hex format) 03E8-03EB 03EC-03EF … … … 04E4-04E7 Description Data block record n.1 of the Event logger Data block record n.2 of the Event logger … … … Data block record n.
The returned values are at FFFFFFFF (hex) when the request data is not valid in the data logger (data not still collected). NOTA: when the value of the single long-integer variable, which contains the event flags, is 000300FF (hex) the meaning is a ‘Restart of the converter’ and the single bit has not significant. Batch memory values Addresses(Hex format) 07D0-07D7 07D8-07DF … … … 0848-084F Description Data block memory batch n. 0 Data block memory batch n. 1 … … … Data block memory batch n.
don’t have practical effect. To every address a various function corresponds. The code number for “on” is FF00 (hex), for “off” is 0000. Others values product the exception n.3. Addresses(Hex format) 0000 0001 0002 0003 0004 Function Description start / stop batch reset batch reset totalizers reset data logger reset events logger NOTE: for reading the index value of the batch memory is necessary to activate the batch function. If the batch function is disabled the system return the exception code n. 4.
Example of the sequence of bytes for return the model and the software version of the converter with the function 110 and the ETP command: MODSV. In this example the address of the converter is 0x01.
0x34 0x20 0x32 0x30 0x30 0x38 0x0D 0x0A 0x73 0xFE ‘4’ ‘’ ‘2’ ‘0’ ‘0’ ‘8’ Carriage return Line feed Modbus checksum Modbus checksum The model and the software version of the converter returned is: “ML 110 VER.3.60 Apr 14 2008” -------------------------------------------------------------------------------------------------------------------------------------- Example of the sequence of bytes for set the Nominal Diameter of the converter with the function 110 and the ETP command: PDIMV.
5.9. EXAMPLE OF SOURCE CODE FOR VB .NET 2005 PROJECT The code below is intended as an example of source code for return the process data from the flow meter via Modbus protocol. The example uses the serial port control present in the tool box of the Visual Basic Net 2005 For the hardware communication it is used a converter RS232 – RS485 connected to the RS232 serial port of the pc and the RS485 port of the converter.
afIntChkHigh(5) = &HC0 afIntChkHigh(6) = &H80 afIntChkHigh(7) = &H41 afIntChkHigh(8) = &H1 afIntChkHigh(9) = &HC0 afIntChkHigh(10) = &H80 afIntChkHigh(11) = &H41 afIntChkHigh(12) = &H0 afIntChkHigh(13) = &HC1 afIntChkHigh(14) = &H81 afIntChkHigh(15) = &H40 afIntChkHigh(16) afIntChkHigh(17) afIntChkHigh(18) afIntChkHigh(19) afIntChkHigh(20) afIntChkHigh(21) afIntChkHigh(22) afIntChkHigh(23) afIntChkHigh(24) afIntChkHigh(25) afIntChkHigh(26) afIntChkHigh(27) afIntChkHigh(28) afIntChkHigh(29) afIntChkHigh(30)
afIntChkHigh(58) afIntChkHigh(59) afIntChkHigh(60) afIntChkHigh(61) afIntChkHigh(62) afIntChkHigh(63) = = = = = = &H80 &H41 &H0 &HC1 &H81 &H40 afIntChkHigh(64) afIntChkHigh(65) afIntChkHigh(66) afIntChkHigh(67) afIntChkHigh(68) afIntChkHigh(69) afIntChkHigh(70) afIntChkHigh(71) afIntChkHigh(72) afIntChkHigh(73) afIntChkHigh(74) afIntChkHigh(75) afIntChkHigh(76) afIntChkHigh(77) afIntChkHigh(78) afIntChkHigh(79) = = = = = = = = = = = = = = = = &H1 &HC0 &H80 &H41 &H0 &HC1 &H81 &H40 &H0 &HC1 &H81 &H40 &H1
afIntChkHigh(111) = &H40 afIntChkHigh(112) afIntChkHigh(113) afIntChkHigh(114) afIntChkHigh(115) afIntChkHigh(116) afIntChkHigh(117) afIntChkHigh(118) afIntChkHigh(119) afIntChkHigh(120) afIntChkHigh(121) afIntChkHigh(122) afIntChkHigh(123) afIntChkHigh(124) afIntChkHigh(125) afIntChkHigh(126) afIntChkHigh(127) = = = = = = = = = = = = = = = = &H1 &HC0 &H80 &H41 &H0 &HC1 &H81 &H40 &H0 &HC1 &H81 &H40 &H1 &HC0 &H80 &H41 afIntChkHigh(128) afIntChkHigh(129) afIntChkHigh(130) afIntChkHigh(131) afIntChkHigh(132
afIntChkHigh(163) afIntChkHigh(164) afIntChkHigh(165) afIntChkHigh(166) afIntChkHigh(167) afIntChkHigh(168) afIntChkHigh(169) afIntChkHigh(170) afIntChkHigh(171) afIntChkHigh(172) afIntChkHigh(173) afIntChkHigh(174) afIntChkHigh(175) = = = = = = = = = = = = = &H40 &H1 &HC0 &H80 &H41 &H1 &HC0 &H80 &H41 &H0 &HC1 &H81 &H40 afIntChkHigh(176) afIntChkHigh(177) afIntChkHigh(178) afIntChkHigh(179) afIntChkHigh(180) afIntChkHigh(181) afIntChkHigh(182) afIntChkHigh(183) afIntChkHigh(184) afIntChkHigh(185) afIntCh
afIntChkHigh(216) afIntChkHigh(217) afIntChkHigh(218) afIntChkHigh(219) afIntChkHigh(220) afIntChkHigh(221) afIntChkHigh(222) afIntChkHigh(223) = = = = = = = = &H0 &HC1 &H81 &H40 &H1 &HC0 &H80 &H41 afIntChkHigh(224) afIntChkHigh(225) afIntChkHigh(226) afIntChkHigh(227) afIntChkHigh(228) afIntChkHigh(229) afIntChkHigh(230) afIntChkHigh(231) afIntChkHigh(232) afIntChkHigh(233) afIntChkHigh(234) afIntChkHigh(235) afIntChkHigh(236) afIntChkHigh(237) afIntChkHigh(238) afIntChkHigh(239) = = = = = = = = = = =
afIntChkLow(5) = &H3 afIntChkLow(6) = &H2 afIntChkLow(7) = &HC2 afIntChkLow(8) = &HC6 afIntChkLow(9) = &H6 afIntChkLow(10) = &H7 afIntChkLow(11) = &HC7 afIntChkLow(12) = &H5 afIntChkLow(13) = &HC5 afIntChkLow(14) = &HC4 afIntChkLow(15) = &H4 afIntChkLow(16) afIntChkLow(17) afIntChkLow(18) afIntChkLow(19) afIntChkLow(20) afIntChkLow(21) afIntChkLow(22) afIntChkLow(23) afIntChkLow(24) afIntChkLow(25) afIntChkLow(26) afIntChkLow(27) afIntChkLow(28) afIntChkLow(29) afIntChkLow(30) afIntChkLow(31) = = = = = = =
afIntChkLow(58) afIntChkLow(59) afIntChkLow(60) afIntChkLow(61) afIntChkLow(62) afIntChkLow(63) = = = = = = &H13 &HD3 &H11 &HD1 &HD0 &H10 afIntChkLow(64) afIntChkLow(65) afIntChkLow(66) afIntChkLow(67) afIntChkLow(68) afIntChkLow(69) afIntChkLow(70) afIntChkLow(71) afIntChkLow(72) afIntChkLow(73) afIntChkLow(74) afIntChkLow(75) afIntChkLow(76) afIntChkLow(77) afIntChkLow(78) afIntChkLow(79) = = = = = = = = = = = = = = = = &HF0 &H30 &H31 &HF1 &H33 &HF3 &HF2 &H32 &H36 &HF6 &HF7 &H37 &HF5 &H35 &H34 &HF4
afIntChkLow(111) = &H2C afIntChkLow(112) afIntChkLow(113) afIntChkLow(114) afIntChkLow(115) afIntChkLow(116) afIntChkLow(117) afIntChkLow(118) afIntChkLow(119) afIntChkLow(120) afIntChkLow(121) afIntChkLow(122) afIntChkLow(123) afIntChkLow(124) afIntChkLow(125) afIntChkLow(126) afIntChkLow(127) = = = = = = = = = = = = = = = = &HE4 &H24 &H25 &HE5 &H27 &HE7 &HE6 &H26 &H22 &HE2 &HE3 &H23 &HE1 &H21 &H20 &HE0 afIntChkLow(128) afIntChkLow(129) afIntChkLow(130) afIntChkLow(131) afIntChkLow(132) afIntChkLow(133)
afIntChkLow(163) afIntChkLow(164) afIntChkLow(165) afIntChkLow(166) afIntChkLow(167) afIntChkLow(168) afIntChkLow(169) afIntChkLow(170) afIntChkLow(171) afIntChkLow(172) afIntChkLow(173) afIntChkLow(174) afIntChkLow(175) = = = = = = = = = = = = = &H79 &HBB &H7B &H7A &HBA &HBE &H7E &H7F &HBF &H7D &HBD &HBC &H7C afIntChkLow(176) afIntChkLow(177) afIntChkLow(178) afIntChkLow(179) afIntChkLow(180) afIntChkLow(181) afIntChkLow(182) afIntChkLow(183) afIntChkLow(184) afIntChkLow(185) afIntChkLow(186) afIntChkLo
afIntChkLow(216) afIntChkLow(217) afIntChkLow(218) afIntChkLow(219) afIntChkLow(220) afIntChkLow(221) afIntChkLow(222) afIntChkLow(223) = = = = = = = = &H5A &H9A &H9B &H5B &H99 &H59 &H58 &H98 afIntChkLow(224) afIntChkLow(225) afIntChkLow(226) afIntChkLow(227) afIntChkLow(228) afIntChkLow(229) afIntChkLow(230) afIntChkLow(231) afIntChkLow(232) afIntChkLow(233) afIntChkLow(234) afIntChkLow(235) afIntChkLow(236) afIntChkLow(237) afIntChkLow(238) afIntChkLow(239) = = = = = = = = = = = = = = = = &H88 &H48 &
"RS 232-485 converter and the PC command the RTS signal of the serial port for" & vbCrLf &_ "the trasmission of the data" lblProcessData.Text = "" SerialPort1.PortName = "COM1" SerialPort1.BaudRate = 9600 SerialPort1.DataBits = 8 SerialPort1.Parity = IO.Ports.Parity.None SerialPort1.StopBits = IO.Ports.StopBits.One SerialPort1.ReadBufferSize = 512 SerialPort1.WriteBufferSize = 512 SerialPort1.Encoding = System.Text.Encoding.Default SerialPort1.Open() SerialPort1.RtsEnable = False Application.
Threading.Thread.Sleep(200) Loop Catch vObjExcept As Exception vfStrErrorString = "Form name: " & Me.Name & vbCrLf & _ "" & vbCrLf & _ "Error source: " & vObjExcept.Source & vbCrLf & _ "" & vbCrLf & _ "Error StackTrace: " & vObjExcept.StackTrace & vbCrLf & _ "" & vbCrLf & _ "Error Message: " & vObjExcept.Message MsgBox(vfStrErrorString, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, Me.
MsgBox(vfStrErrorString, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, Me.Text) Return False End Try End Function Private Sub SerialPort1_DataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles SerialPort1.DataReceived Try TextBox2.Invoke(New myDelegate(AddressOf decode), New Object() {}) Catch vObjExcept As Exception vfStrErrorString = "Form name: " & Me.Name & vbCrLf & _ "" & vbCrLf & _ "Error source: " & vObjExcept.
For vIntN = 0 To vIntBytesToRead - 1 vStrRecevebuffer = vStrRecevebuffer & Chr(afByteReceveBuffer(vIntN)) Next If False = fBolCalcCRC(Mid(vStrRecevebuffer, 1, vIntBytesToRead - 2), vfStrCrc) Then Return End If If vfStrCrc <> (Chr(afByteReceveBuffer(79)) & Chr(afByteReceveBuffer(80))) Then TextBox2.Text = "Bad data ---> Check sum error!" Return End If vbCrLf TextBox2.Text = TextBox2.
afByteTemp(2) = afByteReceveBuffer(20) afByteTemp(3) = afByteReceveBuffer(19) vLngTemp = BitConverter.ToUInt32(afByteTemp, 0) lblProcessData.Text = lblProcessData.Text & "Totalizer for total volume negative T- (E+ for ML211) = " & vLngTemp & vbCrLf 'Totalizer for partial volume negative P- (E- for ML211) afByteTemp(0) = afByteReceveBuffer(26) afByteTemp(1) = afByteReceveBuffer(25) afByteTemp(2) = afByteReceveBuffer(24) afByteTemp(3) = afByteReceveBuffer(23) vLngTemp = BitConverter.
lblProcessData.Text = lblProcessData.Text & "Thermal power value in technical unit (ML211) = " & vLngTemp & vbCrLf 'Delta T value in technical unit (ML211) afByteTemp(0) = afByteReceveBuffer(50) afByteTemp(1) = afByteReceveBuffer(49) afByteTemp(2) = afByteReceveBuffer(48) afByteTemp(3) = afByteReceveBuffer(47) vLngTemp = BitConverter.ToSingle(afByteTemp, 0) lblProcessData.Text = lblProcessData.
lblProcessData.Text = lblProcessData.Text & "Process flags = excitation is too fast for the sensor connected / temperature error ML211" & vbCrLf End If If (afByteReceveBuffer(72) And &H2) = &H2 Then lblProcessData.Text = lblProcessData.Text & "Process flags = max alarm is active" & vbCrLf End If If (afByteReceveBuffer(72) And &H4) = &H4 Then lblProcessData.Text = lblProcessData.Text & "Process flags = min alarm is active" & vbCrLf End If If (afByteReceveBuffer(72) And &H8) = &H8 Then lblProcessData.
End If If (afByteReceveBuffer(71) And &H20) = &H20 Then lblProcessData.Text = lblProcessData.Text & "Process flags = batch in progress" & vbCrLf End If If (afByteReceveBuffer(71) And &H40) = &H40 Then lblProcessData.Text = lblProcessData.Text & "Process flags = calibration cicle in progress" & vbCrLf End If If (afByteReceveBuffer(71) And &H80) = &H80 Then lblProcessData.Text = lblProcessData.
If (afByteReceveBuffer(76) And &H80) = &H80 Then lblProcessData.Text = lblProcessData.Text & "Process flags = min alarm temp. T2" & vbCrLf End If 'Flags ML212 If (afByteReceveBuffer(78) And &H1) = &H1 Then lblProcessData.Text = lblProcessData.Text & "Process flags = command error actuator" & vbCrLf End If If (afByteReceveBuffer(78) And &H2) = &H2 Then lblProcessData.Text = lblProcessData.Text & "Process flags = deviation error" & vbCrLf End If If (afByteReceveBuffer(78) And &H4) = &H4 Then lblProcessData.
6. APPENDIX 6.1. RS232 SERIAL PORT The serial port RS232 present in the aux modules with the RS 232 port option, is used for the connection to printers, modem, personal computer or other devices. The RS232 port is insulated from all other circuits apart from the RS485 port, with which it shares the power supply. This type of interface is used to exchange data over short distances (max. 10 metres) with one single user, usually a PC, a printer or an external modem.
• • • • Menu “7-Comunicazione”, function “ Print data”: set to “ON” if you wish to use the print functions of process Menu “7-Comunicazione”, function “Print events”: set to “ON” if you wish to use the print functions of alarm and converter status Menu «9-Data logger», function - «»: set the date and current time. Menu «9-Data logger», function - « Interv.
INSTANTANEOUS FLOW RATE OF THE TECHNICAL UNIT ARRANGED FOR DISPLAY PRODUCT NAME ( RECEIPT) AND N° OF BATCH T+ P+ RESIDUAL QUANTITY DISBURSED QUANTITY ALARM EXAMPLE: 10/07/03 18:14 dm3/s +4.4423 WATER 32567 T+dm3 123452.222 P+dm3 3452.222 STdm3 200.000 CTdm3 201.121 NO ALARM • PRINT OF BATCH WITH CURRENCY CONVERSION DATE PRODUCT NAME ( RECEIPT) AND N° OF BATCH RESIDUAL QUANTITY DISBURSED QUANTITY DISBURSED QUANTITY CONVERTERD ALARM EXAMPLE: 10/07/03 18:14 WATER 32567 STdm3 200.000 CTdm3 201.121 EUR 402.
ATTENTION: when connecting to a modem, this latter must be configured because it only works autonomously with data lines (without control lines RTS/DTR/CTS/DSR etc.). For this type of configuration, refer to the modem manual. NECESSARY PARAMETERS: • • • • • • • • • • • • • Menu «7-Communication», function - «Speed 2»: set this value to the same speed as the PC or modem. The speed may be chosen from 2400, 9600, 19200 and 38400 bps. Menu «7-Communication», function - «Print»: set to «OFF».
6.2.2. CONNECTING THE CONVERTER TO AN RS485 NETWORK This network is comprised of a certain number of devices each characterised by a univocal address number (for convenience we shall call this type of appliance “SLAVE”), and by a single referee ("MASTER") that interrogates all of the instruments connected in turn: a maximum number of 32 devices can be connected. Example of connection in an RS485 network: o~~~~~o~~~~~~o~~~~~~o~~~~~~o~~~~/......