TN513974a-E

TN513974a-E
Instruction Manual
THERMAL CONDUCTIVITY
GAS ANALYZER
COMMUNICATION
FUNCTIONS (MODBUS)
TYPE:ZAF
INP-TN513974a-E
CONTENTS
1.
COMMUNICATION FUNCTIONS ............................................................................................1
1.1 General................................................................................................................................................1
2.
SPECIFICATIONS .......................................................................................................................2
2.1 Communication specifications............................................................................................................2
3.
CONNECTION.............................................................................................................................3
3.1 Terminal allocation (Input/output terminal CN2) ...............................................................................3
3.2 Connection ..........................................................................................................................................3
4.
SETTING OF COMMUNICATION CONDITION .....................................................................4
4.1 Set items..............................................................................................................................................4
4.2 Setting operation .................................................................................................................................4
5.
MODBUS COMMUNICATION PROTOCOL............................................................................5
5.1
5.2
5.3
5.4
5.5
5.6
6.
DETAILS OF MESSAGE ..........................................................................................................14
6.1
6.2
6.3
6.4
7.
General................................................................................................................................................5
Composition of message .....................................................................................................................6
Response of slave station ....................................................................................................................8
Function code......................................................................................................................................9
Calculation of error check code (CRC-16) .......................................................................................10
Transmission control procedure........................................................................................................12
Read-out of word data [Function code:03H] ..................................................................................14
Read-out of read only word data [Function code:04H] .....................................................................16
Write-in of word data (1 word) [Function code:06H]........................................................................18
Write-in of continuous word data [Function code:10H] .................................................................19
ADDRESS MAP AND DATA FORMAT .................................................................................21
7.1 Data format .......................................................................................................................................21
7.2 Address map .....................................................................................................................................23
7.3 Supplement to address map ..............................................................................................................27
8.
SAMPLE PROGRAM ................................................................................................................28
9.
TROUBLESHOOTING ..............................................................................................................34
INZ-TN513974-E
i
1.
COMMUNICATION FUNCTIONS
1.1
General
• This instrument provides a communication function through RS-232 interface, which allows data transmit to
or receive from the host computer and other devices.
• The communication system is comprised of a master station and slave stations. One slave station (this
instrument) can be connected to one master station.
It is also possible to adapt the instrument to the environment of RS-485 interface using RS-232 ↔ RS-485
converter. In this case, up to 31 of slave station (present instrument) can be connected per master station.
• Because the master station can communicate with only one slave station at a time, the destination can be
identified by the "Station No" set for each slave station.
• In order that the master station and the slave station can communicate, the format of the transmit/receive data
must coincide. In this instrument, the format of the communication data is determined by the MODBUS
protocol.
[RS-232 ↔ RS-485 converter] (recommended article)
Type: KS-485 (non-isolated type)/SYSTEM SACOM Corp.
Type: SI-30A (isolated type)/SEKISUI ELECTRONICS Co., Ltd.
Personal
computer
RS-232
Personal
computer
RS-232
RS-232 RS-485
Converter
Analyzer
RS-485
RS-232
RS-232 RS-485
Converter
Analyzer
INZ-TN513974-E
1
2.
SPECIFICATIONS
2.1
Communication specifications
Item
2
Specification
Electrical specification
Based on EIA RS-232
Transmission system
2-wire, semi-duplicate
Synchronizing system
Start-stop synchronous system
Connection format
1:1
Number connectable units
1 unit (or 31 if RS-485 interface is used)
Transmission speed
9600bps
Data format
Data length
8 bits
Stop bit
1 bit
Parity
None
X flow control
None
Transmission code
HEX value (MODBUS RTU mode)
Error detection
CRC-16
Isolation
No isolation between transmission circuit and others
INZ-TN513974-E
3.
CONNECTION
WARNING
For avoiding electric shock and malfunctions, do not turn on the power supply untill all wiring
have been completed.
3.1
Terminal allocation (Input/output terminal CN2)
Terminal number
3.2
Signal name
2
Recive Data
3
Transmit Data
5
Signal GND
Others
NC
Pin connection
1
5
9-pin D-Sub
(male)
6
9
Connection
As connecting cable, use a commercially available RS-232 reverse cable.
M aster
(PC, for ex.)
Analyzer
Com m unication
cable
Connect the cable to CN2 on the input/output terminal block.
CN2 (communication connector)
INZ-TN513974-E
3
4.
SETTING OF COMMUNICATION CONDITION
In order that the master station and instrument can correctly communicate, following settings are required.
• All communication condition settings of the master station are the same as those of instruments.
• All instruments connected on a line are set to "Station Nos. (STno)" which are different from each other.
"Station No." is not shared by more than one instrument.)
4.1
(Any
Set items
The parameters to be set are shown in the following table. Set them by operating the front panel keys.
Item
Transmission speed
Value at
delivery
9600bps
Fixed (can not be changed)
Data length
8 bits
Fixed (can not be changed)
Stop bit
1 bit
Fixed (can not be changed)
Parity setting
None
Fixed (can not be changed)
Station No.
4.2
Setting range
1
0 to 31
(0:communication function stop)
Remarks
Set the same
communication
condition to the master
station and all slave
stations.
Set a different value to
each station.
Setting operation
Set the station No. on the analyzer maintenance mode display (see the instruction manual).
4
INZ-TN513974-E
5.
MODBUS COMMUNICATION PROTOCOL
5.1
General
The communication system by the MODBUS protocol is that the communication is always started from the
master station and a slave station responds to the received message.
Transmission procedures is as shown below.
1)
The master station sends a command message to a slave station.
2)
The slave station checks that the station No. in the received message matches with the own station No.
or not.
3)
If matched, the slave station executes the command and sends back the response message.
4)
If mismatched, the slave station leaves the command message and wait for the next command message.
a)
In case when the station No. in the received command message matches with the own slave station
No.
Master to slave
Command message
Slave to master
b)
Response message
Data on
the line
In case when the station No. in the received command message mismatches with the own slave
station No.
Master to slave
Slave to master
Command message
(Not respond)
Data on
the line
The master station can individually communicate with any one of slave stations connected on the same line
upon setting the station No. in the command message.
INZ-TN513974-E
5
5.2
Composition of message
Command message and response message consist of 4 fields ; Station No., Function code, Data and Error
check code. And these are send in this order.
Station No. (1 byte)
Function code (1 byte)
Data (2 to 133 bytes)
Error check code (CRC-16) (2 bytes)
Fig. 5-1 Composition of message
In the following, each field is explained.
(1)
Station No.
Station No. is the number specifying a slave station. Only a slave station that corresponds to a value to
which "Station No." is set on the analyzer maintenance mode display executes a command.
(2)
Function code
This is a code to designate the function executed at a slave station.
For details, refer to section 5.4.
(3)
Data
Data are the data required for executing function codes.
codes. For details, refer to chapter 6.
The composition of data varies with function
A register number is assigned to each data in the analyzer. For reading/writing the data by
communication, designate the register number.
Note that the register number transmitted on message is expressed as its relative address.
The relative address is calculated by the following expression.




Relative address = The lower 4 digits of the Register number  – 1
For example, when the resister number designated by a function code is 40003,
Relative address
= (lower 4 digits of 40003) – 1
= 0002
is used on the message.
6
INZ-TN513974-E
(4)
Error check code
This is the code to detect message errors (change in bit) in the signal transmission.
On the MODUBUS protocol (RTU mode), CRC-16 (Cycric Redundancy Check) is applied.
For CRC calculation method, refer to section 5.5.
INZ-TN513974-E
7
5.3
Response of slave station
(1)
Response for normal command
To a relevant message, the slave station creates and sends back a response message which corresponds
to the command message. The composition of message in this case is the same as in section 5.2.
Contents of the data field depend on the function code. For details, refer to Chapter 6.
(2)
Response for abnormal command
If contents of a command message have an abnormality (for example, non-actual function code is
designated) other than transmission error, the slave station does not execute that command but creates
and sends back a response message at error detection.
The composition of response message at error detection is as shown in Fig. 5-2 The value used for
function code field is function code of command message plus 80H.
Table 5-1 gives error codes.
Station No.
Function code + 80H
Error code
Error check(CRC-16)
Fig. 5-2 Response message at error detection
Table 5-1 Error code
Error code
01H
Contents
Illegal function
Description
Non-actual function code is designated.
Check for the function code.
02H
Illegal data address
A relative address of a resister number to which the
designated function code can not be used.
03H
Illegal data value
Because the designation of number is too much, the
area where resister numbers do not exist is
designated.
(3)
No response
Under any of the following items, the slave station takes no action of the command message and sends
back no response.
・ A station number transmitted in the command message differs from the station number specified to
the slave station.
・ A error check code is not matched, or a transmission error (parity error, etc.) is detected.
・ The time interval between the composition data of the message becomes longer than the time
corresponding to 24 bits. (Refer to section 5.6 Transmission control procedure)
8
INZ-TN513974-E
5.4
Function code
According to MODBUS protocol, register numbers are assigned by function codes.
Each function code acts on specific register number.
This correspondence is shown in Table 5-2, and the message length by function is shown in Table 5-3.
Table 5-2 Correspondence between function codes and objective address
Function code
No.
Resister No.
Function
Object
No.
Contents
03H
Read-out
(continuously)
Holding register
4xxxx
Read-out/write-in
04H
Read-out
(continuously)
Input register
3xxxx
Read-out word data
06H
Write-in
Holding register
4xxxx
Read-out/write-in
word data
10H
Write-in
(continuously)
Holding register
4xxxx
Read-out/write-in
word data
word data
Table 5-3 Function code and message length
[Unit : byte]
Function
code
Contents
Number of
designatable
data
Command message
Response message
Minimum Maximum Minimum Maximum
03H
Read-out of word data
60 words
8
8
7
133
04H
Read-out of word data
(read-out only)
15 words
8
8
7
133
06H
Write-in of word data
1 word
8
8
8
8
10H
Write-in of continuous word data
60 words
11
137
8
8
INZ-TN513974-E
9
5.5
Calculation of error check code (CRC-16)
CRC-16 is the 2-byte (16-bits) error check code. From the top of the message (station No.) to the end of the
data field are calculated.
The slave station calculates the CRC of the received message, and does not respond if the calculated CRC is
different from the contents of the received CRC code.
The following shows the calculation procedure for CRC-16.
(a)
Store FFFFH into 16 bit register (CRC register).
(b) Subject the 1st byte (8 bits) of transmit message and CRC register contents to an exclusive logical
summation (XOR), and store the result into the CRC register.
(c)
Shift the CRC register contents 1 bit to the right. Store 0 at MSB.
(d) If LSB before shifting is 0, do nothing.
If LSB before shifting is 1, subject it and A001H to XOR, and store the result into the CRC register.
(e)
Repeat the steps (c) and (d) 8 times (shift by 8 bits).
(f)
Execute steps (b) to (e) for the next byte of the transmit message.
Likewise, successively repeat the steps to each byte of the transmit message.
(g) The CRC code that is retained is the value of CRC register that stands when the processing has ended for
latest byte (latest data except error code) of the transmit message.
(h) As error check code of the transmit message, store this CRC value in the order of lower 8 bits and upper 8
bits.
Transmit message (ex.)
01H
06H
00H
05H
03H
E8H
99H
75H
Successively calculate data included here
to obtain CRC. In this case, CRC = 75
99H.
Attach the error check code to
message upon interchanging the
upper and lower orders.
Fig. 5-3 shows the flow of the CRC-16 calculation system.
10
INZ-TN513974-E
Start
Explanation of variables
CR:CRC error check data (2 bytes)
I:Digits of calculation characters
in command message
J:Check on the number of times
of CR calculation
Set FFFFH (hexadecimal number) in CR.
Set 1 in I.
Exclusive logical sum (XOR) is executed
with CR and one character (1 byte) of #I of
the message, and its results is set in CR.
Set 1 in J.
Bit at right end
of CR is 1?
NO
YES
Shift CR to right by 1 bit, and A001H and
exclusive logical sum (XOR) are executed
and its result is set in CR.
Shift CR to right
by 1 bit.
Add 1 to J.
NO
Calculation (8 times) is
finished?
J>8
YES
Add 1 to I.
NO
Calculation of all characters is
completed?
I>All characters
YES
End
(Calculation is executed in the order of
command message station No., function
code and data.)
CR calculation result shall be added to
the last command message in the order
of LOW byte and HIGH byte.
Fig. 5-3 Flow of CRC-16 calculation
INZ-TN513974-E
11
5.6
Transmission control procedure
(1)
Transmission procedure of master station
The master station must proceed to a communication upon conforming to the following items.
(1-1)
Before sending a command message, provide 48 bits time or more vacant status.
(1-2)
For sending, the interval between bytes of a command message is below 24 bits time.
(1-3)
Within 24 bits time after sending a command message, the receiving status is posted.
(1-4)
Provide 48 bits time or more vacant status between the end of response message reception and
beginning of next command message sending [same as in (1-1)].
(1-5)
For ensuring the safety, make a confirmation of the response message and make an arrangement
so as to provide 3 times or more retries in case of no response, error occurrence, etc.
Note) The above definition is for most unfavorable value. For ensuring the safety, it’s recommended
the program of the master to work with safety factors of 2 to 3. Concretely, it is advised to
arrange the program for 9600 bps with 10 ms or more for vacant status (1-1), and within 1 ms
for byte interval (1-2) and changeover from sending to receiving (1-3).
(2)
Description
1)
Detection of the message frame
The status on the line of the communication system is one of the 2 below.
(a)
Vacant status (no data on line)
(b) Communication status (data is existing)
Instruments connected on the line are initially at a receiving status and monitoring the line.
When 24 bits time or more vacant status has appeared on the line, the end of preceding frame
is assumed and, within following 24 bits time, a receiving status is posted. When data
appears on the line, instruments receive it while 24 bits time or more vacant status is detected
again, and the end of that frame is assumed. I.e., data which appeared on the line from the
first 24 bits time or more vacant status to the next 24 bits time or more vacant status is
fetched as one frame.
Therefore, one frame (command message) must be sent upon confirming the following.
(1-1) 48 bits time or more vacant status precedes before the command message sending.
(1-2) Interval between bytes of 1 command message is smaller than 24 bits time.
2)
Response of this instrument
After a frame detection (24 bits time or more vacant status), this instrument carries out processing
with that frame as a command message. If the command message is destined to the own station,
a response message is returned. Its processing time is 1 to 30 ms (depends on contents of
command message). After sending a command message, therefore, the master station must
observe the following.
(1-3) Receiving status is posted within 24 bits time after sending a command message.
12
INZ-TN513974-E
Space time of longer than 5ms is needed
(longer than 10ms is recommended)
Master station → Analyzer
POL1
POL2
1 to 30msec
Master station ← Analyzer
Data on line
INZ-TN513974-E
POL1 response data
POL1
POL1 response data
POL2
13
6.
DETAILS OF MESSAGE
6.1
Read-out of word data
[Function code:03H]
Function code Max. word number read-out in
one message
03H
64 words
(1)
Relative data address
Resister No.
Contents
0000H-0023H
40001-40036
User setting
Message composition
Command message composition (byte)
Response message composition (byte)
Station No.
Station No.
Function code
Function code
Read-out start No.
Upper
Read-out byte number
(relative address)
Lower
Read-out word
number
Upper
Upper
Contents of the
first word data
Lower
CRC data
Lower
Lower
Upper

 1 to 64

Read-out word number×2
Contents of the Upper
next word data
Lower
—
—
Contents of the Upper
last word data
Lower
Lower
CRC data
Upper
* Arrangement of read-out word data
MSB
LSB
Upper byte of contents of the first word data
Lower byte of contents of the first word data
Upper byte of contents of the next word data
Lower byte of contents of the next word data
—
—
Upper byte of contents of the last word data
Lower byte of contents of the last word data
(2)
Function explanations
Word data of continuous word numbers from the read-out start No. can be read.
are transmitted from the slave station in the order of upper and lower bytes.
14
Read-out word data
INZ-TN513974-E
(3)
Message transmission (example)
The following shows an example of reading out from No. 1 station the setting range-1 zero and span
calibration concentration.
Relative address of range-1 zero calibration concentration setting: 0000H
Command message composition (byte)
Data number: 02H
Response message composition (byte)
Station No.
01H
Station No.
01H
Function code
03H
Function code
03H
00H
Read-out byte number
04H
Read-out start No.
Upper
(relative address)
Lower 00H
Read-out word
number
Upper
CRC data
00H
Lower 02H
Lower C4H
Upper
0BH
Contents of the
first word data
Upper
00H
Lower
00H
Contents of the
next word data
Upper
0BH
Lower
B8H
Lower
FD H
Upper
71H
CRC data
* Meaning of read-out data
Range-1 zero calibration concentration setting
(contents of first word data)
Range-1 span calibration concentration setting
(contents of next word data)
00 00H
0B
B8H
= 0
= 3000
Provided decimal point position = 3,
Set value lower limit = 0.0 vol%
Set value upper limit =3.0 vol%
Point
INZ-TN513974-E
For handling of decimal point and unit, refer to Section 7.1.
15
6.2
Read-out of read only word data [Function code:04H]
Function
code
Max. word number read-out in
one message
Relative data address
Resister No.
Contents
04H
64 words
0000H-0068H
30001-30105
Measurement value and
status
(1)
Message composition
Command message composition (byte)
Response message composition (byte)
Station No.
Station No.
Function code
Function code
Read-out start No.
(relative address)
Read-out word
number
CRC data
Upper
Read-out byte number
Lower
Contents of the Upper
first word data
Lower
Upper
Lower
Lower
Upper
Read-out word number×2
Contents of the Upper
next word data
Lower
—
—
Contents of the last Upper
word data
Lower
CRC data
* Arrangement of read-out word data
MSB
Lower
Upper
LSB
Upper byte of contents of the first word data
Lower byte of contents of the first word data
Upper byte of contents of the next word data
Lower byte of contents of the next word data
—
—
Upper byte of contents of the last word data
Lower byte of contents of the last word data
(2)
Function explanations
Word data of continuous word numbers from the read-out start No. can be read.
are transmitted from the slave station in the order of upper and lower bytes.
16
Read-out word data
INZ-TN513974-E
(3)
Message transmission (example)
The following shows an example of reading out from No. 1 station the measurement concentration,
decimal point position and measurement unit.
Relative address of measurement concentration: 0000H Data number: 02H
Command message composition (byte)
Response message composition (byte)
Station No.
01H
Station No.
01H
Function code
04H
Function code
04H
00H
Read-out byte number
04H
Read-out start No.
Upper
(relative address)
Lower 00H
Read-out word
number
Upper
CRC data
00H
Lower 02H
Lower 71H
Upper
CBH
Contents of the
first word data
Upper
0AH
Lower
8DH
Next word data
contents
Upper
00H
Lower
03H
Lower
28H
Upper
76H
CRC data
* Meaning of read-out data
First word data contents
Next word data contents
0A 8DH = 2701
00 03H =
3 (decimal point position)
In the above case, measurement concentration = 2.701 vol%
Point
INZ-TN513974-E
For handling of decimal point and unit, refer to Section 7.1.
17
6.3
Write-in of word data (1 word) [Function code:06H]
Function code Max. word number write-in
in one message
06H
(1)
1 word
Relative data address
Resister No.
Contents
0000H-0023H
40001-40036
User setting
07D0H-07D2H
42001-42003
Operation command
Message composition
Command message composition (byte)
Station No.
Station No.
Function code
Function code
Write-in designate
No. (relative
address)
Write-in word data
CRC data
(2)
Response message composition (byte)
Write-in
designate No.
(relative address)
Write-in word
data
Upper
Lower
Upper
Lower
Lower
Lower
Upper
Lower
Lower
CRC data
Upper
Upper
Upper
Function explanation
Designated word data is written in write-in designate No. Write-in data are transmitted from master
station in the order of upper and lower bytes.
(3)
Message transmission (example)
The following shows an example of transmitting the "ZERO" key command to No. 1 station.
Key operation command Relative address: 07D0H
Command message composition (byte)
Station No.
01H
Station No.
01H
Function code
06H
Function code
06H
Write-in designate
No. (relative
address)
Write-in word data
CRC data
18
Response message composition (byte)
Upper
07H
Lower
D0H
Upper
00H
Lower
02H
Lower
08H
Upper
86H
Write-in designate
No. (relative
address)
ZERO key
command
Write-in word data
CRC data
Upper
07H
Lower
D0H
Upper
00H
Lower
02H
Lower
08H
Upper
86H
INZ-TN513974-E
6.4
Write-in of continuous word data
[Function code:10H]
Function code
Max. word number write-in
in one message
Relative data address
Resister No.
Kind of data
10H
64 words
0000H-0023H
40001-40036
User setting
(1)
Message composition
Command message composition (byte)
Response message composition (byte)
Station No.
Station No.
Function code
Function code
Write-in start No.
Upper
Write-in start No.
Upper
(relative address)
Lower
(relative address)
Lower
Write-in word
number
Upper
Write-in word
number
Upper

 1 to 60

Lower

 Write-in word number×2

Write-in byte number
CRC data
Lower
Lower
Upper
Upper
First write-in word
data
Lower
Next write-in word
data
Lower
Upper
—
—
Last write-in word
data
CRC data
Upper
Lower
Lower
Upper
* Arrangement of write-in word data
MSB
LSB
Upper byte of contents of the first word data
Lower byte of contents of the first word data
Upper byte of contents of the next word data
Lower byte of contents of the next word data
—
—
Upper byte of contents of the last word data
Lower byte of contents of the last word data
(2)
Function explanation
Word data of continuous word number is written from write-in start address. Write-in word data are
transmitted from master station in the order of upper and lower bytes.
INZ-TN513974-E
19
(3)
Message transmission (example)
The following shows an example of writing the CH1 (1st component) alarm settings to No. 1 station.
Range1 alarm 1-step set value = 07D0H (= 2000P)
Range1 alarm 2-step set value = 03E8H (= 1000P)
Range2 alarm 1-step set value = 0384H (= 900P)
Range2 alarm 2-step set value = 0064H (= 100P)
Range1 alarm 1-step set value
Relative address: 0023H
Command message composition (byte)
Data number: 04H
Response message composition (byte)
Station No.
01H
Station No.
01H
Function code
10H
Function code
10H
Write-in start No.
Write-in word
number
Upper
00H
Lower
05H
Upper
00H
Lower
04H
Write-in byte number
First write-in word
data
Next write-in word
data
Next write-in word
data
Last write-in word
data
CRC data
Point
08H
Upper
07H
Lower
D0H
Upper
03H
Lower
E8H
Upper
03H
Lower
84H
Upper
00H
Lower
64H
Lower
0BH
Upper
FFH
Write-in start No.
Write-in word
number
CRC data
Upper
00H
Lower
05H
Upper
00H
Lower
04H
Lower
D1H
Upper
CBH
Since the transmission data can not include a decimal point, data of 2.000 is
transmitted as "2000".
For transmission format of each data, refer to the Address map (Chapter 7).
20
INZ-TN513974-E
7.
ADDRESS MAP AND DATA FORMAT
7.1
Data format
7.1.1
Transmission data format
The MODBUS protocol used in this instrument is RTU (Remote Terminal Unit) mode.
Transmitted data is "numeric value" and not ASCII code".
7.1.2
Handling of decimal point position and measurement unit
When transmitted, the calibration concentration setting, alarm's high and low limits and measurement
concentration data have no decimal point nor measurement unit.
Calculate exact values of data upon point positioning as shown below.
(a)
Calibration concentration setting (register No. 40001 to 40004)
Alarm setting (register No. 40006 to 40009)
Decimal point position that corresponds to each range can be known by reading the decimal point
position data (Register No. 30002).
The decimal point position data has a value of 0, 1, 2 or 3. You can obtain an exact value by the
following calculation.
Case 0: Calibration concentration setting data /1
Case 1: Calibration concentration setting data /10
Case 2: Calibration concentration setting data /100
Case 3: Calibration concentration setting data /1000
For example, in the case;
Range 1 span calibration concentration set value (Register No. 40002 = 3000, and
Range1 decimal point position (Register No. 30002) = 3, the value will be 3.000 vol%.
For writing-in, proceed in the reverse. To obtain 3.000 vol%, write 3000 as calibration
concentration setting.
The decimal point position and unit are unchangeable because fixed to each CH and each range.
INZ-TN513974-E
21
(b) Measurement concentration (register No. 30001)
The decimal point position for each concentration are stored in registers following that of
concentration, and can be known by reading them in.
The meaning of decimal point position data and measurement unit data values are the same as in
(a) above.
For example, if:
Measurement concentration (register No. 30001) = 1270,
Decimal point position (register No. 30002) = 3,
the value is 12.70 vol%
7.1.3
Handling at measurement data over-range
Even if the measurement data is at over-range, with "— — — —" displayed on the screen, the
concentration that stands then is transmitted as read-out measurement concentration.
22
INZ-TN513974-E
7.2
Address map
For details of functions and settable ranges of different parameters, refer to the instruction manual for the
analyzer.
Word data [read-out/write-in]: Function code [03H, 06H, 10H]
User settings
Relative Register
address
No.
Data
type
Memory contents
Read/Write data
Remarks
Corresponding
parameters
0000H
40001
INT
Range1 zero calibration concentration
0 to 9999
0001H
40002
INT
Range1 span calibration concentration
0002H
40003
INT
Range2 zero calibration concentration
Decimal point position varies by
that of each range
0003H
40004
INT
Range2 span calibration concentration
0004H
40005
INT
Calibration status
0:Display range,
1: Range interlock
calstate
0005H
40006
INT
Range1 alarm 1-step set value
0 to 9999
limit[0][0]
0006H
40007
INT
Range1 alarm 2-step set value
0007H
40008
INT
Range2 alarm 1-step set value
Decimal point position varies by
that of each range
0008H
40009
INT
Range2 alarm 2-step set value
0009H
40010
INT
Alarm mode
0: Upper limit 1-step,
1: Upper limit 2-step,
2: Lower limit 1-step,
3: Lower limit 2-step,
4: Upper lower limit,
5: Upper limit + Lower limit
limit_mode
000AH
40011
INT
Alarm switch
0: Alarm OFF, 1: Alarm ON
limit_sw
000BH
40012
INT
Alarm hysteresis
0H to 14H (0 to 20% FS)
hyster
000CH
40013
INT
Automatic calibration start time
(Day-of-week)
0H to 07H (Sunday to Saturday)
acal_week
000DH
40014
INT
Automatic calibration start time (Hour)
0H to 23H (BCD code)
acal_hour
000EH
40015
INT
Automatic calibration start time (Minute)
0H to 58H (BCD code)
acal_min
000FH
40016
INT
Automatic calibration cycle
1 to 99 hours/1 to 40 days
cal_cycle
0010H
40017
INT
Unit of automatic calibration cycle
0: Hour, 1: Day
cal_cycle_mode
0011H
40018
INT
Automatic calibration switch
0: OFF, 1: ON
raautcals
0012H
40019
INT
Automatic calibration gas flowing time
60 to 599 seconds
flow
0013H
40020
INT
Key-lock switch
0: OFF, 1: ON
rafkeylk
0014H
40021
INT
Remote range switch
0: OFF, 1: ON
rafremtra
0015H
40022
INT
Response speed
1 to 60 seconds
response[0]
0016H
40023
INT
Response speed (Temperature)
30 seconds
response[1]
0017H
40024
INT
Response speed (Interference component) 1 to 60 seconds
response[2]
0018H
40025
INT
Hold switch
0: OFF, 1: ON
rafholdst
0019H
40026
INT
Range changeover setting
0: Range1, 1: Range2
range_sel
INZ-TN513974-E
cal_val[0][0]
cal_val[1][1]
limit[1][1]
23
Word data [read-out/write-in]: Function code [03H, 06H, 10H]
User settings
Relative Register
address
No.
24
Data
type
Memory contents
Read/Write data
Remarks
Corresponding
parameters
001AH
40027
INT
Backlight switch
0: OFF, 1: ON
back_light_sw
001BH
40028
INT
Backlight out time
5 to 99 minutes
back_light_time
0: Always off, 1:Zero valve,
2: Span valve, 3: Calibrating status,
4: Pump, 5: Upper limit alarm,
6: Upper limit 2-step alarm,
7: Lower limit alarm,
8: Lower limit 2-step alarm,
9: Upper lower limit alarm,
10: Analyzer error,
11: Range identification,
12: Always on
001CH
40029
INT
Contact output allocation (1)
001DH
40030
INT
Contact output allocation (2)
001EH
40031
INT
Contact output allocation (3)
001FH
40032
INT
Contact output allocation (4)
0020H
40033
INT
Contact output allocation (5)
0021H
40034
INT
0022H
40035
INT
Range1 measurement screen decimal point 0: No decimal point position,
disp_digit_pos[0]
position
1: one digit below decimal point,
2: 2 digits below decimal point, 3:
Range2 measurement screen decimal point
disp_digit_pos[1]
3 digits below decimal point
position
0023H
40036
INT
Date/time display flag
0: Non-display, 1: Display
doutsell
doutse12
doutse13
doutse14
doutse15
disp_watch_flg
INZ-TN513974-E
Word data [read-out only] : Function code[04 H]
User data
Relative Register
address
No.
Data
type
0001H
30002
INT
Decimal point position
0002H
30003
INT
Reserved
0003H
30004
INT
Concentration value
0004H
30005
INT
Concentration value’s decimal point
position
0005H
30006
INT
Reserved
1: Concentration value /10
0006H
30007
INT
Interference component’s concentration
value
2: Concentration value /100
0007H
30008
INT
Interference component’s decimal point
position
0008H
30009
INT
Reserved
0009H
30010
INT
Current range
0:Range1, 1:Range2
000AH
30011
INT
1-step alarm
0:No alarm, 1:Alarming status
000BH
30012
INT
2-step alarm
0:No alarm, 1:Alarming status
000CH
30013
INT
Automatic calibrating status
0:None, 1: Calibrating status
000DH
30014
INT
Zero calibrating status
0:None, 1: Calibrating status
000EH
30015
INT
Span calibrating status
0:None, 1: Calibrating status
000FH
30016
INT
Analyzer error
0:None, 1: Error
0010H
30017
INT
Latest error No
-1: Empty, 4 to 9
0011H
30018
INT
Latest error WEEK
1 to 7 (Sunday to Saturday)
0012H
30019
INT
Latest error HOUR
0 to 23 (Hour)
0013H
30020
INT
Latest error MIN
0 to 59 (Minute)
0014H
30021
INT
Reserved
0015H
30022
INT
Previous error No
-1: Empty, 4 to 9
0016H
30023
INT
Previous error WEEK
1 to 7 (Sunday to Saturday)
0017H
30024
INT
Previous error HOUR
0 to 23 (Hour)
0018H
30025
INT
Previous MIN
0 to 59 (Minute)
0019H
30026
INT
Reserved
to
to
to
Remarks
Corresponding
parameters
Concentration value:
-9999 to 9999
30001
to
Concentration value
Readout data
0000H
INZ-TN513974-E
INT
Memory contents
(Display value equivalent to no
decimal point value)
Decimal point position: 0, 1, 2, or
3.
(0: Concentration value /1
3: Concentration value /1000)
range_id_cur
Transmits
sequentially from
latest error.
to
25
Word data [read-out only] : Function code[04 H]
User data
Relative Register
address
No.
Data
type
Memory contents
Readout data
Oldest error No
-1: Empty, 4 to 9
INT
Oldest error WEEK
1 to 7 (Sunday to Saturday)
INT
Oldest error HOUR
0 to 23 (Hour)
INT
Oldest error MIN
0 to 59 (Minute)
30086
INT
Reserved
0056H
30087
INT
Error No.4
0057H
30088
INT
Error No.5
0058H
30089
INT
Error No.6
0059H
30090
INT
Error No.7
005AH
30091
INT
Error No.8
005BH
30092
INT
Error No.9
005CH
30093
INT
Automatic zero calibrating status
005DH
30094
INT
Automatic span calibrating status
005EH
30095
INT
Holding status
005FH
30096
INT
Screen information (1)
0060H
30097
INT
Reserved
0061H
30098
INT
Reserved
0062H
30099
INT
Key operation management information
0063H
30100
INT
Latest calibration history
-1:Empty, 0:Zero calibration,
1:Span calibration
0064H
30101
INT
Calibration coefficient
Zero /span calibration coefficient
0065H
30102
INT
Analog input value
Analog input value at calibration
time
0066H
30103
INT
Year, month
Year;0 to 99, Month: 1to 12
0067H
30104
INT
Date, hour
Date: 1 to 31, Hour: 0 to 23
0068H
30105
INT
Minute, second
Minute: 0 to 59, Second: 0 to 59
0051H
30082
0052H
30083
0053H
30084
0054H
30085
0055H
INT
Remarks
Corresponding
parameters
0:None, 1:Error occurs
0:Off, 1:On
manual_key
cal_log_area[]
Word data: Function code [06H]
For adjustment (Only word by word writing allowed)
Relative Register
address
No.
26
Data
type
Memory contents
Read/Write data
Remarks
Corresponding
parameters
07D0H
42001 BYTE Key operation command
80H:MODE, 40H: Right or left, entern_key
20H:Up, 10H:Down, 0.8H:ESC,
04H:ENT02H:ZERO, 01H:SPAN
07D1H
42002
INT
Screen switching
1:Returns to Measurement screen backto_meas_flg
07D2H
42003
INT
Main unit reset
1:Resets Main unit
reset_flg
INZ-TN513974-E
7.3
Supplement to address map
*(1)
Register No. 30017 to 30085 (Error log)
From Error log, up to 14 errors occurred in the past can be read sequentially from newer one.
The contents are,
Error No.: Occurred error number. The stored value is the value decremented by 1 from the error
number
Error WEEK: Day-of week when the error occurred
Error HOUR: Hour when the error occurred
Error MIN: Minute when the error occurred
*(2)
Register No. 30096 (Screen information (1))
The screen information is the value to know the current screen status of the Analyzer.
• Screen information (1): Contents of the value (status of each setting screen),
0: Measurement mode screen (incl. Manual calibration screen)
1: Menu mode screen
2: Range changeover screen
3: Calibration setting screen
4: Alarm setting screen
5: Automatic calibration setting screen
6: Interference correction
7: Parameter mode screen
8: Maintenance mode screen
9: Factory mode screen
INZ-TN513974-E
27
8.
SAMPLE PROGRAM
This chapter concerns data read-out/write-in sample program which operates on N88-Japanese BASIC (*2) for PC-9801
(*1) or compatible PCs.
Note that the program shown here is for reference for you to create a program and not for guaranteeing all actions.
Before executing the program, make sure of the communication conditions in the following procedure.
• Communication speed (baud rate):
Match the conditions with this instrument using SWITCH command and SPEED command of MS-DOS (*3).
For SWITCH command and SPEED command, refer to the reference manual of MS-DOS.
•
28
Data length, stop bits and parity:
Set in this program. Match the conditions with this instrument.
*1
PC-9801 series are products of NEC Corporation.
*2
N88-Japanese BASIC is a registered trade mark of NEC Corporation.
*3
MS-DOS is a registered trade mark of Microsoft Corporation.
INZ-TN513974-E
(a) Example of data read-out
Operation: Read-out CH1 measurement concentration value.
(Continuous word read-out from read-out only area)
Used function code
: 04H
Read-out start register No. : 30001
Read-out word number
:3
1000 '------------------------------------------------------1010 '
READ CONTINUOUS WORDS
SAMPLE PROGRAM
1020 '------------------------------------------------------1030 '
1040 ' Transmission speed = 9600 bps (selected with SPEED command and SWITCH command of MS-DOS)
1050 '
1060 CLS
1070 DIM CC(255)
1080 '
1100 '-------------- Send data setting ----------------------1110 CC(1)=&H01
'Station No.
= 1
1120 CC(2)=&H04
'Function code = 04H
1130 CC(3)=&H00
'Upper byte of relative address(0000H) of resister No.30001
1140 CC(4)=&H00
'Lower byte of relative address(0000H) of resister No.30001
1150 CC(5)=&H00
'Upper byte of read-out word data(0003H)
1160 CC(6)=&H03
'Lower byte of read-out word data(0003H)
1170 COUNT=6
1200 '
1210 '------------- CRC code calculation of send data -------------1220 GOSUB *CRC.CALC
1230 CC(7)=CRC.L
'Lower byte of CRC calculation result → Upper byte in message
1240 CC(8)=CRC.H
'Upper byte of CRC calculation result → Lower byte in message
1250 COUNT=COUNT+2
1300 '
1310 '------------- Send data ----------------------------1320 PRINT " Sending data > ";
1330 OPEN "COM1:N81NN" AS #1
' No parity ・・・ "N81NN""
1340
1350
1360 FOR I=1 TO COUNT
1370
PRINT #1,CHR$(CC(I));
1380
PRINT RIGHT$("0"+HEX$(CC(I)),2);" "; 'Displaying on screen
'Writing in transmission port
1390 NEXT I
1400 '
1410 FOR I=O TO 12000 :NEXT I
' Interval time
1500 '
INZ-TN513974-E
29
1510 '------------- Data receive ---------------------------1520 PRINT
1530 LENGTH=LOC(1)
'Number of data in receiving buffer
1540 IF LENGTH=0 THEN PRINT "No answer" :END
1550 PRINT " Receiving data < ";
1560 FOR I=1 TO LENGTH
1570
X$=INPUT$(1,#1)
'Taking data from receiving buffer
1580
CC(I)=ASC(X$)
'Digitizing and storing
1590
PRINT RIGHT$("0"+HEX$(CC(I)),2);" "; 'Displaying on screen
1600 NEXT I
1610 CLOSE #1
1620 COUNT=LENGTH-2
1630 GOSUB *CRC.CALC
1700 '
1710 '------------- Transmission error check ----------------------1720 PRINT
1730 CRC.L$=RIGHT$("0"+HEX$(CRC.L),2)
1740 CRC.H$=RIGHT$("0"+HEX$(CRC.H),2)
1750 PRINT "CRC calculation = ";CRC.L$;" ";CRC.H$
1760 IF CC(LENGTH-1)<>CRC.L THEN GOTO *ER.MESSAGE
1770 IF CC(LENGTH)<>CRC.H THEN GOTO *ER.MESSAGE
1780 GOTO *PRT.RESULT
1790 *ER.MESSAGE
1800 PRINT "Communication error"
1810 END
1900 '
1910 '------------- Display of result --------------------------1920 *PRT.RESULT
1930
1940 PRINT
1950 VALUE=HEX$(CC(4))+RIGHT$("0"+HEX$(CC(5)),2)
1960 DE$=HEX$(CC(6))+RIGHT$("0"+HEX$(CC(7)),2)
'2byte → 1word
'2byte → 1word
1970
IF VAL ("&H"+DE$)=0 THEN CONC=VAL ("&H"+VALUE$)/1
1980
IF VAL ("&H"+DE$)=0 THEN CONC=VAL ("&H"+VALUE$)/10
1990
IF VAL ("&H"+DE$)=0 THEN CONC=VAL ("&H"+VALUE$)/100
2000
IF VAL ("&H"+DE$)=0 THEN CONC=VAL ("&H"+VALUE$)/1000
2010 UNIT$="vol%"
2020
2030
2020 Print "CH1 measurement concentration =";CONC;UNIT
2030 END
3000 '
30
INZ-TN513974-E
3010 '------------ CRC calculation -----------------------------3020 *CRC.CALC
' For contents, refer to CRC calculation flow chart
3030 CR=&HFFFF
3040 FOR I=1 TO COUNT
3050
CR=CR XOR CC(I)
3060
FOR J=1 TO 8
3070
CT=CR AND &H1
3080
IF CR<0 THEN CH=1 ELSE CH=0:GOTO *CRC.CALC.10
3090
3100
CR=CR AND &H7FFF
*CRC.CALC.10
3110
CR=INT(CR/2)
3120
IF CH=1 THEN CR=CR OR &H4000
3130
3140
IF CT=1 THEN CR=CR XOR &HA001
NEXT J
3150 NEXT I
3160 CRC.L=CR AND &HFF
' Lower byte of CRC calculation
3170 CRC.H=((CR AND &HFF00)/256 AND &HFF)
' Upper byte of CRC calculation
3180 RETURN
INZ-TN513974-E
31
(b) Data write-in example
Operation : Change CH1 measurement range via communication
(Single word write-in)
Used function code
: 06H
Write-in register No.
: 40026
Write-in data
: 1 (changeover from range 1 to range 2)
1000 '------------------------------------------------------1010 '
WRITE 1 WORD
SAMPLE PROGRAM
1020 '------------------------------------------------------1030 '
1040 ' Transmission speed = 9600 bps (selected with SPEED command and SWITCH command of MS-DOS)
1050 '
1060 CLS
1070 DIM CC(255)
1080 '
1100 '-------------- Send data setting ----------------------1110 CC(1)=&H01
' Station No.
1120 CC(2)=&H06
' Function code = 06H
= 1
1130 CC(3)=&H00
' Upper byte of relative address(0019H) of resister No.40106
1140 CC(4)=&H19
' Lower byte of relative address(0019H) of resister No.40106
1150 CC(5)=&H00
' Upper byte of Write-in word data(0001H)
1160 CC(6)=&H01
' Lower byte of Write-in word data(0001H)
1170 COUNT=6
1200 '
1210 '------------- CRC code calculation of send data -------------1220 GOSUB *CRC.CALC
1230 CC(7)=CRC.L
' Lower byte of CRC calculation result → Upper byte in message
1240 CC(8)=CRC.H
' Upper byte of CRC calculation result → Lower byte in message
1250 COUNT=COUNT+2
1300 '
1310 '------------- Send data ----------------------------1320 PRINT "Sending data > ";
1330 OPEN "COM1:N81NN" AS #1
' No parity ・・・ "N81NN "
1340
1350
1360 FOR I=1 TO COUNT
1370
PRINT #1,CHR$(CC(I));
' Writing transmission port
1380
PRINT RIGHT$("0"+HEX$(CC(I)),2);" "; ' Displaying on screen
1390 NEXT I
1400 '
1410 FOR I=O TO 12000 :NEXT I
' Interval time
1500 '
32
INZ-TN513974-E
1510 '------------- Data receive ---------------------------1520 PRINT
1530 LENGTH=LOC(1)
'Number of data in receiving buffer
1540 IF LENGTH=0 THEN PRINT "No answer" :END
1550 PRINT "Receiving data < ";
1560 FOR I=1 TO LENGTH
1570
X$=INPUT$(1,#1)
'Taking data from receiving buffer
1580
CC(I)=ASC(X$)
'Digitizing and storing
1590
PRINT RIGHT$("0"+HEX$(CC(I)),2);" "; 'Displaying on screen
1600 NEXT I
1610 CLOSE #1
1620 COUNT=LENGTH-2
1630 GOSUB *CRC.CALC
1700 '
1710 '------------- Transmission error check ----------------------1720 PRINT
1730 CRC.L$=RIGHT$("0"+HEX$(CRC.L),2)
1740 CRC.H$=RIGHT$("0"+HEX$(CRC.H),2)
1750 PRINT "CRC calculation = ";CRC.L$;" ";CRC.H$
1760 IF CC(LENGTH-1)<>CRC.L THEN GOTO *ER.MESSAGE
1770 IF CC(LENGTH)<>CRC.H THEN GOTO *ER.MESSAGE
1780 GOTO *PRT.RESULT
1790 *ER.MESSAGE
1800 PRINT "Communication error"
1810 END
1900 '
1910 '------------- Display of result --------------------------1920 *PRT.RESULT
1930 PRINT
1940 PRINT " Range change ended "
1950 END
3000 '
3010 '------------ CRC calculation -----------------------------3020 *CRC.CALC
'For contents, refer to CRC calculation flow
3030 CR=&HFFFF
3040 FOR I=1 TO COUNT
3050
CR=CR XOR CC(I)
3060
FOR J=1 TO 8
3070
CT=CR AND &H1
3080
IF CR<0 THEN CH=1 ELSE CH=0:GOTO *CRC.CALC.10
3090
3100
CR=CR AND &H7FFF
*CRC.CALC.10
3110
CR=INT(CR/2)
3120
IF CH=1 THEN CR=CR OR &H4000
3130
IF CT=1 THEN CR=CR XOR &HA001
3140 NEXT J
3150 NEXT I
3160 CRC.L=CR AND &HFF
'Lower byte of CRC calculation
3170 CRC.H=((CR AND &HFF00)/256 AND &HFF)
'Upper byte of CRC calculation
3180 RETURN
INZ-TN513974-E
33
9.
TROUBLESHOOTING
If the communication is unavailable, check the following items.
□
Whether all devices related to communication are turned on.
□
Whether connections are correct.
□
Whether the number of connected instruments and connection distance are as specified
□
Whether communication conditions coincide between the master station (host computer) and slave stations
(instrument)
□
Transmission speed
:
9600bps
□
Data length
:
8 bits
□
Stop bit
:
1 bit
□
Parity
:
None
□
Whether send/receive signal timing conforms to Section 5.6 in this manual.
□
Whether the station No. designated as send destination by the master station coincides with the station No. of
the connected instrument.
□
Whether more than one instrument connected on the same transmission line shares the same station No.
□
Whether the station No. of instruments is set at other than 0.
If it’s 0, the communication function does not work.
34
INZ-TN513974-E
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement