Download as pdf or txt
Download as pdf or txt
You are on page 1of 36

Dokumenttyp/Document type Infoklass/Info class

Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 1(1)

Fördelning/To För Kännedom/Copy

PROGRAMVARA-TRL/2-SPEC
+ GKT, GRT, GLM, GLM-TO, GLM-AA, GLM-
EW
GLM-HCM, GLP, GLP-AC, GLP-MR, GLP-JA
GLP-AW, GLP-PE, GLP-RM,
GPP, GPB, GPR, GPS, GKP-EE, GKP-VK
Document reviewed 1992-02-20
Review group members:
GD, GLS-RH, GKS-SJ, GRE-LL

MODBUS FOR TRL/2: STANDARD QUESTION


1 GENERAL .................................................................................................................2
2 MODBUS PROTOCOL ............................................................................................4
3 DATA FUNCTIONS .................................................................................................8
4 DIAGNOSTIC FUNCTIONS ....................................................................................21
5 DEVICE DESCRIPTONS .........................................................................................23
6 DATA FUNCTION EXAMPLES .............................................................................30
7 EXCEPTION RESPONSES ......................................................................................34
8 CRC GENERATION.................................................................................................35

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 2(2)

1 GENERAL

1.1 Identification
This document specifies the protocol for communication between a HOST computer and Saab
TankRadar L/2 units, except OPI, using the MODBUS standard protocol defined in document
GOULD MODICON MODBUS PROTOCOL Reference Guide.

1.2 Revision History

Issue 1
Issue 2 92/05/05
Added RTG analog inputs to FCU/OPI database.
Added more explanations to value order.
Changed "level status" to "RTG status".
Added CRC-16 code.
Issue 3 92/09/10
RTG status changed.
Issue 4 92/10/27
Added additional registernumbers for FC02,
FC03 and FC04.
Modified chapter addresses and examples.
DAU NMI approval.
Issue 5 94/07/04
OPI interface moved to TRL/2-93.156
Calibration error and system error bits in DAU
status added.
Added general description of values in protocol.
Issue 6 96/05/20
Corrected CRC in examples.
RTG status changed.
Issue 7 98/02/06
FCU diagnostic register is available to host
computers. See chapter 5.2.1 FCU Diagnostic
register.(FCU program version 3.B0 or later is
required for this functionality.)
Added the other applicable devices.
COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 3(3)

Reorganized the document.

1.3 Definitions
AI Analog inputs
COS Configuration Software , DOS based program (Saab Tank Control)
DAU Data Acquisition Unit
DC Diagnostic
FB FCU Fieldbus
FBM Field Bus Modem
FCU Field Connection Unit
GB FCU Groupbus
HOST Host Computer
NMI Nederlands MeetInstituut.
OPI Operators Interface program, used in TRL2 on a PC (Saab Tank Control)
RTG Radar Tank Gauge
TBD To Be Defined
TRL2 SAAB TankRadar L/2
TRL2 Units DAU, FCU, OPI, RTG

1.4 Reference
1. Modicon Modbus Protocol Reference Guide PI-MBUS-300 Rev G.
Nov 1994 MODICON, Inc.
2. The Modbus Protocol applied to the TRL2 Communication TRL2-89.28 Issue 2
System
3. Protocol specification-TRL/2 OPI Modbus host protocol TRL/2-93.156

1.5 File Storage


i:\gks\gks9106.doc

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 4(4)

2 MODBUS PROTOCOL

2.1 Introduction
The communication between the HOST and the OPI or FCU is done on a standard RS-232C serial
link. Connecting the Host’s serial link to the FBM and the TRL2 bus makes connection to RTG and
DAU.
The Modbus protocol transmission mode is RTU (Remote Terminal Unit) which means that all
transferred data will be in binary.
The HOST computer will be the MASTER in the communication, which requests data from the
SLAVE (the TRL2 units).
Error checking is done by adding a CRC (Cyclic Redundancy Check) word at the end of each
message.
The FCU supports different devices connected as slaves to the Field busses:
RTG, DAU, LABKO2000 and Echowave.

When a sensor failure or communication failure has occurred, then the value is unchanged. The
HOST MUST ask for sensor status. This means that if the status of the level is set to error or to
communication failure the value will not be changed to 0 or 0FFFFH or similar.

2.2 Framing
The general format of one message is:

Byte no 1 Slave address (01-F7H)


2 Function code
n Data
n+1 High order CRC-16
n+2 Low order CRC-16

FUNCTION code:
The function code in the message defines what actions are to be performed or what data is to be
transmitted.
There are a number of different Modbus function codes, each one assigned to a specific function.

In the HOST - FCU communication function codes: 02, 03, 04 and 08 are used.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 5(5)

In the HOST - DAU and RTG communication function codes: 04 and 08 are used.

The RTG, DAU and FCU may answer on other function code, but the HOST should not use them.
The rest of the functions will be answered by exception code 1 (see chapter 7).

DATA field:
Contains query information from HOST to TRL2 units or response data from TRL2 units in
response to the query from HOST.

CRC-16:
Contains the CRC-16 word, the high order byte is sent first. The high order byte is defined as the
MSB of the CRC calculation but is the lower part of the CRC-16 word. See also chapter 2.7.

2.3 Unit
The units of the parameters are the same as defined in the system.

Unit in the system Unit of the response value


m 1/10 mm Level as Double word
m mm Level, Ullage as word
feet inch inch/16 1/256 inch Level as Double word
feet inch inch/16 1/16 inch Level, Ullage as word
m/h 1/100 m/h Level Rate
f/h 1/10 f/h Level Rate
ºC 1/10 ºC
ºF 1/10 ºF

2.4 Value order


The dynamic data (level, average temperature) in FCU are stored after each other in the same order
that the devices RTG, LABKO2000, Echowave and DAU are configured in the FCU slave-database.
The COS software can be used to setup the FCU.

If the following slave configuration exist in the FCU:

Level device position Modbus FC03 register for Tank level (HEX)
1 680
2 681
5 684

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 6(6)

Temperature transmitter position Modbus FC03 register for Average temperature (HEX)
1 680
3 682

2.5 Addresses

Every TRL/2 unit in a system has a unique address. This address could range from 1 to 247.

2.6 Values
The format of the values is always in 2-complement except for registers mentioned as bit-register or
status where each bit must be decoded.
2 complement:

Explanation 1: Means that the value can be negative and is defined as a 2-complemet value.

Explanation 2: 2-complement means that the most significant digit is decoded as the sign (+/-) on
the value, i.e. if the value >= 8000H it is negative. To extract the sign from the value apply the
following formula (but don't forget the "-" character):
value EXOR FFFFH + 1 .

Example: E876H = E876H EXOR FFFFH + 1 = - 6026 .

See chapter 6 for further examples.

2.7 Serial Transmission mode - RTU


Electrical interface : RS 232C, handshake signals RTS and CTS

Coding : 8 bit binary, continuos stream (= not more than 3


1/2 character time between characters is
allowed). E.g. For 4800 baud, a 7.2 ms delay
between bytes will be decoded as start of a new
message.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 7(7)

Baude rate : 4800 bits per second

Character data : 1 start bit


8 data bits
no parity
1 stop bit

Error checking : CRC-16 (Cyclical Redundancy Check)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 8(8)

3 DATA FUNCTIONS

3.1 Data addresses in Modbus Messages


All data addresses in Modbus messages are referenced to zero. The first occurrence of a data item is
addressed as item number zero. For example:
• Holding register 40001 is addressed as register 0000 in the data address field of the message.
The function code field already specifies a ‘holding register’ operation. Therefor 4XXXX
reference is implicit.
• Holding register 41536 is addressed as register 5FF hex (FCU diagnostic register).

3.2 Function code 02 - Read input status

3.2.1 Description

Reads the alarm status (ON/OFF) of discrete inputs (1XXXX references) in the slave.

3.2.2 Query and response format

The query format:


Byte no 1: Slave address (01-F7H)
2: Function code 02
3: h.o. data start address
4: l.o. data start address
5: h.o. number of points
6: l.o. number of points
7: High order CRC-16
8: Low order CRC-16

The response format:


Byte no 1: Slave address (01-F7H)
2: Function code 02
3: Byte count
4: first data
. .
. .
COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 9(9)

n: last data
n+1: High order CRC-16
n+2: Low order CRC-16

Sensor data: a '0' means working, a '1' means sensor failure.

Alarm data: a '0' means normal, a '1' means alarm.

Data will be packed with one bit for each sensor input. The lower order bit of the first character
contains the addressed input, and the remainder follows. For input quantities that are not even
multiples of eight, the last character will be filled in with zeros at high order end.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 10(10)

3.2.3 FCU FC02 Data Addresses

The FCU will set all corresponding bits to 1 in case of subsystem communication failure.

Data address in Hex Parametertype


8600 - 863F (spare)
8640 - 865F (spare)
8660 - 867F Level Rate status
8680 - 869F Level status
86A0 - 86BF Ullage status
86C0 - 86DF Analog input 1 status
86E0 - 86FF Analog input 2 status
8700 - 871F Analog input 3 status
8720 - 875F (spare)
8760 - 877F Temp 14 status
8780 - 879F Temp 13 status
87A0 - 87BF Temp 12 status
87C0 - 87DF Temp 11 status
87E0 - 87FF Temp 10 status
8800 - 881F Temp 9 status
8820 - 883F Temp8 status
8840 - 885F Temp 7 status
8860 - 887F Temp 6 status
8880 - 889F Temp 5 status
88A0 - 88BF Temp 4 status
88C0 - 88DF Temp 3 status
88E0 - 88FF Temp 2 status
8900 - 891F Temp 1 status
8920 - 893F (spare)
8940 - 895F (spare)
8960 - 897F (spare)
8980 - 899F Temp avg. status
89A0 - 89BF (spare)
89C0 - 89DF Current input 1 status
89E0 - 89FF Current input 2 status
8A00 - 8A1F Current input 3 status
8A20 - 8A3F Current input 4 status
8A40 - 8A5F Frequency input 8 status
8A60 - 8A7F Frequency input 7 status
8A80 - 8A9F Frequency input 6 status
8AA0 - 8ABF Frequency input 5 status
8AC0 - 8ADF Frequency input 4 status
8AE0 - 8AFF Frequency input 3 status
8B00 - 8B1F Frequency input 2 status
8B20 - 8B3F Frequency input 1 status
8B40 - 8B5F (spare)
8B60 - 8B7F Relay 1 status
8B80 - 8B9F Relay 2 status
8BA0 - 8BBF Relay 3 status
8BC0 - 8BDF Relay 4 status
8BE0 - 8BFF Digital input status (indicates only if DAU is not answering)
COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 11(11)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 12(12)

3.2.4 FCU FC02 mirror Data Addresses

Compare with chapter 3.2.3. It’s the same values but different data addresses.
The FCU will set all corresponding bits to 1 in case of subsystem communication failure.

Data address in Hex Parametertype


600 – 63F (spare)
640 – 65F (spare)
660 – 67F Level Rate status
680 – 69F Level status
6A0 – 6BF Ullage status
6C0 – 6DF Analog input 1 status
6E0 – 6FF Analog input 2 status
700 – 71F Analog input 3 status
720 – 75F (spare)
760 – 77F Temp 14 status
780 – 79F Temp 13 status
7A0 – 7BF Temp 12 status
7C0 – 7DF Temp 11 status
7E0 – 7FF Temp 10 status
800 – 81F Temp 9 status
820 – 83F Temp 8 status
840 – 85F Temp 7 status
860 – 87F Temp 6 status
880 – 89F Temp 5 status
8A0 – 8BF Temp 4 status
8C0 – 8DF Temp 3 status
8E0 – 8FF Temp 2 status
900 – 91F Temp 1 status
920 – 93F (spare)
940 – 95F (spare)
960 – 97F (spare)
980 – 99F Temp avg. status
9A0 – 9BF (spare)
9C0 – 9DF Current input 1 status
9E0 – 9FF Current input 2 status
A00 – A1F Current input 3 status
A20 – A3F Current input 4 status
A40 – A5F Frequency input 8 status
A60 – A7F Frequency input 7 status
A80 – A9F Frequency input 6 status
AA0 – ABF Frequency input 5 status
AC0 – ADF Frequency input 4 status
AE0 – AFF Frequency input 3 status
B00 – B1F Frequency input 2 status
B20 – B3F Frequency input 1 status
B40 – B5F (spare)
B60 – B7F Relay 1 status
B80 – B9F Relay 2 status
BA0 – BBF Relay 3 status

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 13(13)

BC0 – BDF Relay 4 status


BE0 – BFF Digital input status (indicates only if DAU is not answering)

3.3 Function code 03 - Read holding registers

3.3.1 Description

Reads the binary contents of holding registers (4XXXX references) in the slave.

3.3.2 Query and response format

The query format:


Byte no 1: Slave address (01-F7H)
2: Function code 03
3: h.o. first data address
4: l.o. first data address
5: h.o. number of points
6: l.o. number of points
7: High order CRC-16
8: Low order CRC-16

The response format:


Byte no 1: Slave address (01-F7H)
2: Function code 03
3: Byte count
4: h.o. first register data
5: l.o. first register data
.
.
2n+2: h.o. last register data
2n+3: l.o. last register data
2n+4: High order CRC-16
2n+5: Low order CRC-16

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 14(14)

3.3.3 FCU FC03 Data Addresses

Data address in Hex Parametertype


85FF Diagnostic register (see chapter 5.2.1)
8600 – 863F Level (in Double word) (see chapter 2.6)
8640 – 865F Level Device Status (Level, Levelrate, Ullage and Analog Input status see chapter 5)
8660 – 867F Level Rate
8680 – 869F Level (in Word)
86A0 – 86BF Ullage (in Word)
86C0 – 86DF Analog input 1
86E0 - 86FF Analog input 2
8700 – 871F Analog input 3
8720 – 875F (spare)
8760 – 877F Temp 14
8780 – 879F Temp 13
87A0 – 87BF Temp 12
87C0 – 87DF Temp 11
87E0 - 87FF Temp 10
8800 – 881F Temp 9
8820 – 883F Temp 8
8840 – 885F Temp 7
8860 – 887F Temp 6
8880 – 889F Temp 5
88A0 – 88BF Temp 4
88C0 – 88DF Temp 3
88E0 - 88FF Temp 2
8900 – 891F Temp 1
8920 – 893F Temp in liquid (see chapter 5.4)
8940 – 895F Temp status (blocked) (see chapter 5.4)
8960 – 897F Temp status (error) (see chapter 5.4)
8980 – 899F Temp avg.
89A0 – 89BF Current status (see chapter 5.4)
89C0 – 89DF Current input 1
89E0 - 89FF Current input 2
8A00 - 8A1F Current input 3
8A20 - 8A3F Current input 4
8A40 - 8A5F Frequency input 8
8A60 - 8A7F Frequency input 7
8A80 - 8A9F Frequency input 6
8AA0 - 8ABF Frequency input 5
8AC0 - 8ADF Frequency input 4
8AE0 - 8AFF Frequency input 3
8B00 - 8B1F Frequency input 2
8B20 - 8B3F Frequency input 1
8B40 - 8B5F Frequency status (see chapter 5.4)
8B60 - 8B7F Relay status (see chapter 5.4)
8B80 - 8B9F Digital input status (see chapter 5.4)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 15(15)

3.3.4 FCU FC03 mirror Data addresses

Compare with chapter 3.3.3. It’s the same values but different data addresses.

Data address in Hex Parametertype


5FF Diagnostic register (see chapter 5.2.1)
600 – 63F Level (Double Word, see chapter 2.6)
640 – 65F Level Device Status (Level, Levelrate, Ullage and Analog Input status see chapter 5)
660 – 67F Level Rate
680 – 69F Level (in Word)
6A0 – 6BF Ullage (in Word)
6C0 – 6DF Analog input 1
6E0 – 6FF Analog input 2
700 – 71F Analog input 3
720 – 75F (spare)
760 – 77F Temp 14
780 – 79F Temp 13
7A0 – 7BF Temp 12
7C0 – 7DF Temp 11
7E0 – 7FF Temp 10
800 – 81F Temp 9
820 – 83F Temp 8
840 – 85F Temp 7
860 – 87F Temp 6
880 – 89F Temp 5
8A0 – 8BF Temp 4
8C0 – 8DF Temp 3
8E0 – 8FF Temp 2
900 – 91F Temp 1
920 – 93F Temp in liquid (see chapter 5.4)
940 – 95F Temp status (blocked) (see chapter 5.4)
960 – 97F Temp status (error) (see chapter 5.4)
980 – 99F Temp avg.
9A0 – 9BF Current status (see chapter 5.4)
9C0 – 9DF Current input 1
9E0 – 9FF Current input 2
A00 – A1F Current input 3
A20 – A3F Current input 4
A40 – A5F Frequency input 8
A60 – A7F Frequency input 7
A80 – A9F Frequency input 6
AA0 – ABF Frequency input 5
AC0 – ADF Frequency input 4
AE0 – AFF Frequency input 3
B00 – B1F Frequency input 2
B20 – B3F Frequency input 1
B40 – B5F Frequency status (see chapter 5.4)
B60 – B7F Relay status (see chapter 5.4)
B80 – B9F Digital input status (see chapter 5.4)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 16(16)

3.4 Function code 04 - Read input registers

3.4.1 Description

Reads the binary contents of input registers (3XXXX references) in the slave.

3.4.2 Query and response format

The query format:


Byte no 1: Slave address (01-F7H)
2: Function code 04
3: h.o. first register number
4: l.o. first register number
5: h.o. number of registers
6: l.o. number of registers
7: High order CRC-16
8: Low order CRC-16

The response format:


Byte no 1: Slave address (01-F7H)
2: Function code 04
3: Byte count
4: h.o. first register data
5: l.o. first register data
.
.
2n+2: h.o. last register data
2n+3: l.o. last register data
2n+4: High order CRC-16
2n+5: Low order CRC-16

3.4.3 RTG FC04 Data Addresses

Data address in Hex Parametertype Composition


00 Level (2 registers, see chapter 2.6) (2
complement)
02 Status

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 17(17)

03 Level rate (2 complement)


04 Level (2 complement)
05 Ullage
If the RTG have analog inputs then will those be included
in the standard-question.
06 Analog current input 1
07 Analog current input 2
08 Analog current input 3

3.4.4 DAU FC04 Data Addresses

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 18(18)

Data address in Hex Parametertype


0B Temp 14
0C Temp 13
0D Temp 12
0E Temp 11
0F Temp 10
10 Temp 9
11 Temp 8
12 Temp 7
13 Temp 6
14 Temp 5
15 Temp 4
16 Temp 3
17 Temp 2
18 Temp 1
19 Temp in liquid (see chapter 5.4)
1A Temp status (blocked) (see chapter 5.4)
1B Temp status (error) (see chapter 5.4)
1C Temp avg.
1D Current status (see chapter 5.4)
1E Current input 1
1F Current input 2
20 Current input 3
21 Current input 4
22 Frequency input 8
23 Frequency input 7
24 Frequency input 6
25 Frequency input 5
26 Frequency input 4
27 Frequency input 3
28 Frequency input 2
29 Frequency input 1
2A Frequency status (see chapter 5.4)
2B Relay status (see chapter 5.4)
2C Digital input status (see chapter 5.4)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 19(19)

3.4.5 FCU FC04 Data Addresses

Data address in Hex Parametertype


85FF Diagnostic register (see chapter 5.2.1)
8600 - 863F Level (in Double word) (see chapter 2.6)
8640 - 865F Level Device Status (Level, Levelrate, Ullage and Analog Input status see chapter 5)
8660 - 867F Level Rate
8680 - 869F Level (in Word)
86A0 - 86BF Ullage (in Word)
86C0 - 86DF Analog input 1
86E0 - 87FF Analog input 2
8700 - 871F Analog input 3
8720 - 875F (spare)
8760 - 877F Temp 14
8780 - 879F Temp 13
87A0 - 87BF Temp 12
87C0 - 87DF Temp 11
87E0 - 87FF Temp 10
8800 - 881F Temp 9
8820 - 883F Temp 8
8840 - 885F Temp 7
8860 - 887F Temp 6
8880 - 889F Temp 5
88A0 - 88BF Temp 4
88C0 - 88DF Temp 3
88E0 - 88FF Temp 2
8900 - 891F Temp 1
8920 - 893F Temp in liquid (see chapter 5.4)
8940 - 895F Temp status (blocked) (see chapter 5.4)
8960 - 897F Temp status (error) (see chapter 5.4)
8980 - 899F Temp avg.
89A0 - 89BF Current status (see chapter 5.4)
89C0 - 89DF Current input 1
89E0 - 89FF Current input 2
8A00 - 8A1F Current input 3
8A20 - 8A3F Current input 4
8A40 - 8A5F Frequency input 8
8A60 - 8A7F Frequency input 7
8A80 - 8A9F Frequency input 6
8AA0 - 8ABF Frequency input 5
8AC0 - 8ADF Frequency input 4
8AE0 - 8AFF Frequency input 3
8B00 - 8B1F Frequency input 2
8B20 - 8B3F Frequency input 1
8B40 - 8B5F Frequency status (see chapter 5.4)
8B60 - 8B7F Relay status (see chapter 5.4)
8B80 - 8B9F Digital input status (see chapter 5.4)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 20(20)

3.4.6 FCU FC04 mirror Data Addresses

Compare with chapter 3.4.5. It’s the same values but different data addresses.

Data address in Hex Parametertype


5FF Diagnostic register (see chapter 5.2.1)
600 - 63F Level (in Double word) (see chapter 2.6)
640 - 65F Level Device Status (Level, Levelrate, Ullage and Analog Input status see chapter 5)
660 - 67F Level Rate
680 - 69F Level (in Word)
6A0 - 6BF Ullage (in Word)
6C0 - 6DF Analog input 1
6E0 - 7FF Analog input 2
700 - 71F Analog input 3
720 - 75F (spare)
760 - 77F Temp 14
780 - 79F Temp 13
7A0 - 7BF Temp 12
7C0 - 7DF Temp 11
7E0 - 7FF Temp 10
800 - 81F Temp 9
820 - 83F Temp 8
840 - 85F Temp 7
860 - 87F Temp 6
880 - 89F Temp 5
8A0 - 8BF Temp 4
8C0 - 8DF Temp 3
8E0 - 8FF Temp 2
900 - 91F Temp 1
920 - 93F Temp in liquid (see chapter 5.4)
940 - 95F Temp status (blocked) (see chapter 5.4)
960 - 97F Temp status (error) (see chapter 5.4)
980 - 99F Temp avg.
9A0 - 9BF Current status (see chapter 5.4)
9C0 - 9DF Current input 1
9E0 - 9FF Current input 2
A00 - A1F Current input 3
A20 - A3F Current input 4
A40 – A5F Frequency input 8
A60 – A7F Frequency input 7
A80 – A9F Frequency input 6
AA0 - ABF Frequency input 5
AC0 - ADF Frequency input 4
AE0 - AFF Frequency input 3
B00 – B1F Frequency input 2
B20 – B3F Frequency input 1
B40 – B5F Frequency status (see chapter 5.4)
B60 – B7F Relay status (see chapter 5.4)
B80 – B9F Digital input status (see chapter 5.4)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 21(21)

4 DIAGNOSTIC FUNCTIONS

4.1 Function 08

4.1.1 Query and response format

The query format:


Byte no 1: Slave address (01-F7H)
2: Function code 08
3: h.o. diagnostic code
4: l.o. diagnostic code
5: h.o. data field
6: l.o. data field
7: High order CRC-16
8: Low order CRC-16

The response format:


Byte no 1: Slave address (01-F7H)
2: Function code 08
3: h.o. diagnostic code
4: l.o. diagnostic code
5: h.o. data field
6: l.o. data field
7: High order CRC-16
8: Low order CRC-16

4.2 RTG, DAU, FCU FC08

4.2.1 Return Query Data (DC0)

Query message is returned unchanged. The query data field may contain any data.

4.2.2 Other Diagnostic Functions

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 22(22)

The RTG, DAU and FCU may answer on other diagnostic functions than DC1, DC2 and DC4, but
the HOST should not use them. The other diagnostic functions will be answered by exception code
7 (see chapter 7).

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 23(23)

5 DEVICE DESCRIPTONS
This chapter describes the devices, which can be connected to the host via Modbus protocol directly
or indirect via connection to the FCU device.

5.1 Devices connected to FCU


RTG, DAU, LABKO2000 and Echowave can be connected to the FCU device. These devices’
dynamic data can therefor be found in the FCU dynamic database and polled by the host, see chapter
3.3.4.

5.2 FCU register details

5.2.1 FCU Diagnostic register

Note: FCU program version 3.B0 or later is required for this functionality.
The FCU diagnostic register is available in FC03 and FC04 in data address 85FF (hex) or 5FF (hex)
in mirror data addresses.

Bit 0 =1 Program checksum error.


Bit 1 = 1 E2PROM checksum error.
Bit 2 = 1 RAM error.
Bit 3 = 1 Watchdog is set.
Bit 4 =1 EEPROM switch in mode "write inhibit".
Bit 5 =1 Port 0 error. (default GB 1)
Bit 6 =1 Port 1 error. (default GB 2)
Bit 7 =1 Port 2 error. (default FB 1)
Bit 8 =1 Port 3 error. (default FB 2)
Bit 9 =1 Port 4 error. (default FB 3)
Bit 10=1 Port 5 error. (default FB 4)
Bit 11=1 SME internal
Bit 12=1 Back-up FCU is active

If any of the bits 0-2 are set, all devices connected to the FCU will be flagged as communication
failure.

5.3 RTG register details

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 24(24)

Device Status as in the form of RTG status:

RTG Flash 2.C10 specification:

Bit 0 – 3 Not used


Bit 4 – 6 = 1 Analog input 1 - 3 errors.
Bit 7 = 1 Used by master to indicate RTG comm. failure.
Bit 8 LPG verify copy.
Bit 9-11 Not used
Bit 12 NMI-approved RTG
Bit 13 NMI legal level (#-inverted). Not NMI = 0.
Bit 14 = 1 Level warning. LPG correction failed.
Bit 15 = 1 Valid level.

RTG Flash 4.A1 specification and later:

RTG status: (NOTE ! When using later flash software than 4.A1 check with SAAB Tank Control
for current layout or consult the input specification for that RTG version)

Bit 0 – 3 Not used


Bit 4 – 6 = 1 Analog input 1 - 3 errors.
Bit 7 = 1 Used by master to indicate RTG comm. failure.
Bit 8 LPG verify copy.
Bit 9-10 Not used
Bit 11 Presentation level = M.I.P. level
Bit 12 NMI-approved RTG
Bit 13 NMI legal level (#-inverted). Not NMI = 0.
Bit 14 = 1 Level warning. LPG correction failed.
Bit 15 = 1 Valid level.

More information about RTG status bits:


Bit 4-6: If there is an analog input error 1 - 3 then query data address 114 in input registers
for more detailed information.
Bit 7: Master (FCU or OPI) finds that RTG does not answer. (Master also resets bit 15)
Bit 15: If equal to 1 then the RTG level/levelrate/ullage value is OK, regardless of other bits,
If equal to 0 then the RTG level/levelrate/ullage value is not OK.

5.4 DAU register details

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 25(25)

Temperature in liquid:
Bit 0 = 1 Temp 1 in liquid
Bit 1 = 1 Temp 2 in liquid
Bit 2 = 1 Temp 3 in liquid
Bit 3 = 1 Temp 4 in liquid
Bit 4 = 1 Temp 5 in liquid
Bit 5 = 1 Temp 6 in liquid
Bit 6 = 1 Temp 7 in liquid
Bit 7 = 1 Temp 8 in liquid
Bit 8 = 1 Temp 9 in liquid
Bit 9 = 1 Temp 10 in liquid
Bit 10= 1 Temp 11 in liquid
Bit 11= 1 Temp 12 in liquid
Bit 12= 1 Temp 13 in liquid
Bit 13= 1 Temp 14 in liquid
Bit 14= 1 System error
Bit 15= 1 Temp calibration error. (PTB)

Temperature status (blocked):


Bit 0 = 1 Temp 1 blocked
Bit 1 = 1 Temp 2 blocked
Bit 2 = 1 Temp 3 blocked
Bit 3 = 1 Temp 4 blocked
Bit 4 = 1 Temp 5 blocked
Bit 5 = 1 Temp 6 blocked
Bit 6 = 1 Temp 7 blocked
Bit 7 = 1 Temp 8 blocked
Bit 8 = 1 Temp 9 blocked
Bit 9 = 1 Temp 10 blocked
Bit 10= 1 Temp 11 blocked
Bit 11= 1 Temp 12 blocked
Bit 12= 1 Temp 13 blocked
Bit 13= 1 Temp 14 blocked
Bit 14= 1 Legal NMI-temperature
Bit 15= 1 NMI approved DAU

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 26(26)

Temperature status (error):


Bit 0 = 1 Temp 1 error
Bit 1 = 1 Temp 2 error
Bit 2 = 1 Temp 3 error
Bit 3 = 1 Temp 4 error
Bit 4 = 1 Temp 5 error
Bit 5 = 1 Temp 6 error
Bit 6 = 1 Temp 7 error
Bit 7 = 1 Temp 8 error
Bit 8 = 1 Temp 9 error
Bit 9 = 1 Temp 10 error
Bit 10= 1 Temp 11 error
Bit 11= 1 Temp 12 error
Bit 12= 1 Temp 13 error
Bit 13= 1 Temp 14 error
Bit 14= 1 Master, FCU, set to 1 if DAU does not answer
Bit 15= 1 Temp avg. error. No temp sensor is in liquid

If DAU does not answer then FCU, will set the status =FFFFH.

Current Status:
Bit 0 = 1 Sensor 1 error
Bit 1 = 1 Spare
Bit 2 = 1 Sensor 2 error
Bit 3 = 1 Spare
Bit 4 = 1 Sensor 3 error
Bit 5 = 1 Spare
Bit 6 = 1 Sensor 4 error
Bit 7-13 Spare
Bit 14= 1 Master, FCU set to 1 if DAU does not answer
Bit 15= 1 Calibration error

If DAU does not answer then FCU, OPI will set the status =4055H.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 27(27)

Frequency status:
Bit 0 = 1 Sensor 1 error
Bit 1 = 1 Sensor 2 error
Bit 2 = 1 Sensor 3 error
Bit 3 = 1 Sensor 4 error
Bit 4 = 1 Sensor 5 error
Bit 5 = 1 Sensor 6 error
Bit 6 = 1 Sensor 7 error
Bit 7 = 1 Sensor 8 error
Bit 8-13 Spare
Bit 14= 1 Master, FCU, set to 1 if DAU does not answer
Bit 15 System error

If DAU does not answer then FCU will set the status =40FFH.

Relay status:
Bit 0 = 1 Relay 1 on
Bit 1 = 1 Relay 1 off
Bit 2 = 1 Relay 2 on
Bit 3 = 1 Relay 2 off
Bit 4 = 1 Relay 3 on
Bit 5 = 1 Relay 3 off
Bit 6 = 1 Relay 4 on
Bit 7 = 1 Relay 4 off
Bit 8 = 1 Relay 1 failure
Bit 9 = 1 Relay 2 failure
Bit 10= 1 Relay 3 failure
Bit 11= 1 Relay 4 failure
Bit 12,13 Spare
Bit 14= 1 Master, FCU set to 1 if DAU does not answer
Bit 15 Spare

If DAU does not answer then FCU will set the status =4FxxH.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 28(28)

Digital input status:


Bit 0 = 1 Sensor 1 is high
Bit 1 = 1 Sensor 2 is high
Bit 2 = 1 Sensor 3 is high
Bit 3 = 1 Sensor 4 is high
Bit 4 = 1 Sensor 5 is high
Bit 5 = 1 Sensor 6 is high
Bit 6 = 1 Sensor 7 is high
Bit 7 = 1 Sensor 8 is high
Bit 8-13 Spare
Bit 14= 1 Master, FCU set to 1 if DAU does not answer
Bit 15 Spare

If DAU does not answer then FCU will set the status =40xxH.

5.5 LABKO2000 register details


The LABKO device can’t be connected directly to the Modbus host but only via the FCU Fieldbus.

Level Device Status in the form of Labko status:

Bit 0 – 3 Not used


Bit 4 – 6 Not used
Bit 7 = 1 Used by master to indicate LABKO comm.
failure.
Bit 8 Not used
Bit 9-11 Not used
Bit 12 Not used
Bit 13 Not used
Bit 14 = 1 Not used
Bit 15 = 1 Valid level.

5.6 Echowave register details


The Echowave device can’t be connected directly to the Modbus host but only via the FCU
Fieldbus.

Level Device Status in the form of EW status:

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 29(29)

Bit 0 – 3 Not used


Bit 4 – 6 Not used
Bit 7 = 1 Used by master to indicate Echowave comm.
failure.
Bit 8 Not used
Bit 9-11 Not used
Bit 12 Not used
Bit 13 Not used
Bit 14 = 1 Not used
Bit 15 = 1 Valid level.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 30(30)

6 DATA FUNCTION EXAMPLES


When a sensor failure or communication failure has occurred, then the value is unchanged. The
HOST MUST ask for sensor status.

Below you will find different examples of how requests to FCU and responses from the FCU will
look like.

6.1 FC04 examples

6.1.1 Request to FCU for 5 tank levels

The query to FCU:


Byte No Byte Value Comment
1 22 FCU address
2 04 Function code
3 86 h.o. data address
4 80 l.o. data address (ask for data address 8680H)
5 00 h.o. number of points
6 05 l.o. number of points (ask for 5 registers)
7 1F h.o. CRC
8 FA l.o. CRC

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 31(31)

The response from FCU:


Byte No Byte Value Comment
1 22 FCU address
2 04 Function code
3 0A Number of bytes in response (2*5 bytes)
4 03 h.o. first level data
5 E8 l.o. first level data (3E8H = 1000 mm)
6 07 h.o. second level data
7 D0 l.o. second level data (7D0H = 2000 mm)
8 0B h.o. 3:d level data
9 B8 l.o. 3:d level data (BB8H = 3000 mm)
10 0F h.o. 4:th level data
11 A0 l.o. 4:th level data (FA0H = 4000 mm)
12 13 h.o. 5:th level data
13 88 l.o. 5:th level data (1288H = 5000 mm)
14 CA h.o.CRC
15 FE l.o CRC

6.1.2 Request for 5 tank level status

The query to FCU:


Byte No Byte Value Comment
1 22 FCU address
2 04 Function code
3 86 h.o. data address
4 40 l.o. data address (ask for data address 8640H)
5 00 h.o. number of points
6 05 l.o. number of points (ask for 5 registers)
7 1F h.o. CRC
8 C6 l.o. CRC

The response from FCU:


Byte No Byte Value Comment
1 22 FCU address
2 04 Function code
3 0A Number of bytes in response (2*5 bytes)
4 80 h.o. first RTG status
5 00 l.o. first RTG status (value OK)

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 32(32)

6 D0 h.o. second RTG status


7 01 l.o. second RTG status (value OK)
8 03 h.o. 3:d RTG status
9 80 l.o. 3:d RTG status (value not OK, no response from RTG)
10 01 h.o. 4:th RTG status
11 00 l.o. 4:th RTG status (value not OK)
12 80 h.o. 5:th RTG status
13 13 l.o. 5:th RTG status (value OK)
14 91 h.o.CRC
15 B6 l.o CRC

6.2 FC02 examples


The host can also collect the tank level status by using Function Code 02.

6.2.1 Request for 5 tank level status

The query to FCU:


Byte No Byte Value Comments
1 22 FCU address
2 02 Function code
3 86 h.o. data address
4 80 l.o. data address (ask for data address 8680H)
5 00 h.o. number of points
6 05 l.o. number of points (ask for 5 points)
7 97 h.o. CRC
8 FA l.o. CRC

The response from FCU:


Byte No Byte Value Byte Value
1 22 FCU address
2 02 Function code
3 01 Number of bytes in response
4 0C RTG status data
5 AA h.o.CRC
6 09 l.o CRC

The FC02 tank level status will be decoded as:


Bit 0 = 0 first value OK
Bit 1 = 0 second value OK
COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 33(33)

Bit 2 = 1 3:d value not OK


Bit 3 = 1 4:th value not OK
Bit 4 = 0 5:th value OK
Bit 5-7: ignore them

6.3 Examples of format conversion.

HEX LEVEL (mm) TEMPERATURE ( C )


000AH +10 +1.0
7FFFH +32767 +3276.7
8000H -32768 -3276.8
800AH -32758 -3275.8
FFFFH -1- 0.1

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 34(34)

7 EXCEPTION RESPONSES
If TRL2 units detect an operation error the response will be an exception code.
The Exception response from TRL2 to HOST has the following format:

Byte no 1: Slave address


2: function code (80+received function code)
3: exception code (01-07), see below
4: high order CRC-16
5: low order CRC-16

Exception code Implementation


1 (Illegal function) TRL2 units detect a function code that it does not recognize.
2 (Illegal data address) The request address is higher then the end address
3 (Illegal data value) The data is greater then number of values in the system.
4 (Failure in Associated Device) The FCU or OPI has no contact with the RTG and DAU
5 (Acknowledge) The slave has accepted a command that will take time to
process
6 (Busy) TankRadar L/2 is busy and rejects the message.
7 (Negative Acknowledge) Issued in response to a command that cannot be executed

If not all of the requested memory addresses are valid, only the valid words are returned. If no
address is valid, exception code 2 is returned.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 35(35)

8 CRC GENERATION
The CRC-16 error check sequence is implemented as follows:
The message (data bits only, disregarding start/stop and parity bits) is considered as one continuous
binary number, which most significant bit (MSB) is transmitted first. The message is pre-multiplied
by x**16 (shifted left 16 steps), then divided by x**16 + x**15 + x**2 + 1 expressed as a binary
number (11000000000000101). The integer quotient digits are ignored and the 16-bit remainder
(initialized to all ones at the start to avoid the case of all zeroes being an accepted message) is
appended to the message (MSB first) as the two CRC check bytes. The resulting message including
CRC, when divided by the same polynomial at the receiver will give a zero remainder if no errors
have occurred. The receiving unit recalculates the CRC and compares it to the transmitted CRC. All
arithmetic is performed modulo two (no carry). An example of the CRC-16 error check is found in
the Modicon Modbus Protocol reference guide on pages 1-4 to 1-6.

An example of Intel's PL/M 86 compiler.

Name of function: CRC_CALC

Input
BUF - Pointer to message buffer.
BYTE_NUM - Number of bytes in message (exclusive CRC bytes)

/* declarations */
BUF_IDX word,
IDX byte,
FLAG byte,
CRC word;

/* code: */

CRC = 65535; /* Init */


BUF_IDX = 0; /* Pointer in message */
do while BYTE_NUM > 0;
CRC = CRC xor BUF(BUF_IDX); /* Update CRC */
do IDX = 0 to 7;
FLAG = CRC AND 1; /* Save shift flag */
CRC = shr(CRC, 1); /* Shift one bit right */
if FLAG then /* If flag is one */
CRC = CRC xor 0A001H; /* Update CRC register */
COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998
Dokumenttyp/Document type Infoklass/Info class
Specification P
Reg, nr/Reg. No.

GKS-91.06
Godkänd/Approved by Lagringsdata/Stored at
GKT c:\meus documentos\andré\saab\modbus std question.doc
Utfärdare/Issued by Datum/Date Utgåva/Issue Sida/Page

CL Sven Johansson 2001-03-13 7 36(36)

end;
BYTE_NUM = BYTE_NUM - 1;
BUF_IDX = BUF_IDX + 1;
end;
return CRC;

Example of adding CRC-16 word to the message:

You have a message with the length LENGTH in your application.

/* declarations: */
LENGTH BYTE; /* Length of message , inclusive CRC bytes
*/
MESSAGE (LENGHT) BYTE; /* message buffer */
CRC word;

/* code: */
CRC = CRC_CALC (MESSAGE, LENGHT - 2);

MESSAGE(LENGHT-2) = LOBYTE( CRC ); /* Intel l.o. to CRC h.o.*/


MESSAGE(LENGHT-1) = HIBYTE( CRC ); /* Intel h.o. to CRC l.o.*/

Note: The CRC_CALC function can also swap l.o. and h.o. of CRC word before returning but such
code will be less sufficient than the above example.

COYRIGHT  S SAAB Marine Electronics AB, Sweden, 1991, 1992, 1994, 1996 and 1998

You might also like