Thank you for purchasing the Fuji Digital Temperature Controller.
This document describes how to connect the Micro controller PXG Series (referred to below as "Micro controller") to the personal
computer or programmable controller. It also describes communication specifications for controlling and monitoring the
communications with the micro controller, MODBUS protocol, and address map for the micro controller.
In addition to this document, please make sure to read the Instruction Manual (which comes with the product) and the Operations
Manual (packaged separately).
NOTE
■ Exclusions
The contents of this document may change without prior notice.
Although great care has been taken in the accuracy of this document, Fuji Electric takes no responsibility for loss or indirect
damages caused by mistakes, missing information, or use of information in this document.
Writing Word Data (1 word, function code: 06H)..............34
Writing Continuous Word Data (Function code: 10H) ...... 36
– 2 –
Chapter 1
Communication Functions
Overview – 4
Chapter
1
– 3 –
Overview
Chapter
1
• The micro controller is equipped with communication functions from the RS-485 interface and PC loader interface, which
enables the transmission and reception of data between such devices as the personal computer, programmable controller,
and graphic panel.
• The communication system is composed of a master and slave relationship. Up to thirty-one slaves (micro controllers) may
be connected to one master (such as a personal computer) based on a “single master/multiple slave” method.
• However, the master can only communicate with one slave at a time. Therefore, each slave is specified by the "Station No."
setting.With PC loader communication, only one slave can be connected to one master.
Caution
• In order to have proper communication between master and slave, the transmission data must be in the same format. This
• When using equipment with an RS-232C interface, such as a personal computer, as the master, make sure to use an RS-
• When using PC loader communication, you can use RS-232C communication with the personal computer by connecting the
[RS-232C to RS-485 converter] (Recommended)
Model number/TypeContactURL
KS3C-10 (insulating type) Made by Omron Corporationhttp://www.omron.co.jp
RC-77 (insulating type)Made by RA Systems Corporationhttp://www.ras.co.jp
• Systems constructed with the micro controller as slaves do not respond to messages issued by the master
with broadcast queries where the station number is "0".
• PC loader communication is not compatible with the multiple slave method.
document explains how to transmit data using the MODBUS protocol format.
232C to RS-485 converter.
PC loader interface on the bottom of this unit with the PC loader communication cable (RS-232C, model:
ZZPPXH1
TK4H4563) sold separately.
*
– 4 –
Connecting to a programmable controller
Programmable
controller
RS-485
PXG Series
Connecting to a personal computer
Chapter
1
Caution
Personal
computer
RS-232C
RS-232C to RS-485 converter
RS-485
PXG Series
RS-232C
PC loader communication cable
When using the RS-232C to RS-485 converter, check to make sure that the cable is properly connected between the
converter and master. Communication will not work properly if the connection is incorrect.
Also be sure to correctly set the communication settings (such as communication speed and parity) on the RS-232C
to RS-485 converter. Communication will not work properly if the settings are incorrect.
– 5 –
Chapter
1
MEMO
– 6 –
Chapter 2
Specifications
Communication Specifications – 8
Chapter
2
– 7 –
Chapter
2
Communication Specifications
RS-485
ItemSpecifications
Electrical specificationsEIA RS-485 compliant
Communication methodTwo wire system, half double-bit serial
Synchronous methodAsynchronous
Connection status1:N
Max. no. of connections31 units
Communication distanceMax 500m (total length)
Communication speed9600bps, 19200 bps
Data formatData length8 bits
Stop bit1 bit
ParityNone/Even/Odd (Selectable)
Transmission codeHEX value (MODBUS RTU mode)
Error detectionCRC-16
InsulationFunctional insulation for the transmission area and
other areas (withstanding AC 500V)
PC Loader Interface
ItemSpecifications
Electrical specificationsEIA RS232 C
Communication method3wire system, half double-bit serial
Synchronous methodAsynchronous
Connection status1:1
Station No.1 (Not to be changed)
Communication speed9600 bps (Not to be changed)
Data formatData length8 bits
Stop bit1 bit
Paritynone (Not to be changed)
Transmission codeHEX value (MODBUS RTU mode)
Error detectionCRC-16
InsulationNon-insulated internal circuit
– 8 –
Chapter 3
Connection
Communication Terminal Configuration – 10
●
Wiring – 11
Chapter
3
– 9 –
Chapter
3
Warning
Do not turn on power until all of the wiring is completely finished.
There is a risk of electrical shock or damage.
Communication T erminal Configuration
■ RS-485 (rear terminal)
PXG4
Terminal
Number
7RS-485 +
8RS-485 -
1
7
13
2
8
14
3
9
15
4
10
16
5
11
17
12
6
18
Signal Name
PXG5, PXG9
Terminal
Number
1RS-485 +
2RS-485 -
Signal Name
■ PC Loader Interface
(Bottom, φ2.5, three prong miniature jack)
PXG4
PC Loader Interface
PXG5
PC Loader Interface
PXG9
1
2
3
4
5
6
7
8
9
10
11
12
25
26
27
28
29
30
31
32
33
34
35
36
PC Loader Interface
– 10 –
Wiring
■ RS-485
• Please use a shielded twist pair cable. (Recommended cable: KPEV-SB (made by The Furukawa Electric Co., Ltd.))
• The maximum cable length should be 500m. One master and up to thirty-one micro controllers (slaves) can be connected per
circuit.
• Terminate both ends of the circuit with a terminating resistance of 100
• Ground the shielded cable once towards the master side.
Ω (1/2W or more).
Chapter
Master
RS-485 interface
or
RS-485 side of
RS-232C to RS-485 converter
+
–
SG
Terminating resistance
100W (1/2W)
Shielded twist pair cable
3
Slave
+
–
PXG Series
+
–
PXG Series
+
Terminating resistance
100W (1/2W)
• SG does not have to be connected, but it can be used as an effective countermeasure against communication errors due to
noise.
– 11 –
–
PXG Series
•
When using the micro controller in an area where the imposed noise level is expected to exceed 1000V, we recommend using
a noise filter on the master side as seen in the figure below .
[Noise filter] (recommended): ZRAC2203-11 (made by TDK Corporation)
Chapter
3
Programmable controller
or
Personal computer
+ RS-232C to RS-485 converter
Noise filter
RS-485
PXG Series
• If there are problems with EMC during communication, the noise level can be reduced by using a communication cable with a
ferrite core.
Ferrite core (recommended): ZCAT series (made by TDK Corporation)
MSFC series (made by Morimiya Electric Co., Ltd.)
– 12 –
■ PC Loader Interface
• Use the PC loader communication cable (RS-232C) sold separately.
PXG4
PC loader communication cable (RS-232C)
Master side
Personal
computer
etc.
ZZPPXH1
RS-232C
TK4H4563
*
Chapter
3
PXG5
PXG9
Master side
Personal
computer
etc.
D-Sub 9 pin
PC loader communication cable (RS-232C)
ZZPPXH1
RS-232C
D-Sub 9 pin
TK4H4563
*
PXG4 Bottom view
PXG5 Bottom view
Master side
Personal
computer
etc.
PC loader communication cable (RS-232C)
ZZPPXH1
RS-232C
D-Sub 9 pin
TK4H4563
*
PXG9 Bottom view
– 13 –
Chapter
3
MEMO
– 14 –
Chapter 4
Setting Communication Parameters
Chapter
List of Setting Parameters – 16
●
Parameter Setting Procedure – 17
4
– 15 –
Chapter
4
The following settings are required for proper communication between the master and micro controller units.
•
The communication parameters for the master and all of the units must be set the same.
•
During RS-485 communication, all of the micro controllers on a circuit must be set with different "Station No. (STno)" other
than "0 (zero)". (Multiple micro controllers must not have the same "Station No.".)
When using the PC loader interface, settings are not necessary on the main unit (the micro controller).
•
List of Setting Parameters
The setting parameters are shown in the chart shown below. Change the settings using the keys on the front of the micro
controller.
■
RS-485 (main unit side)
Parameter
channel
CoM Ch9
"
(CoM Ch9)
■
Loader interface (main unit side)
Parameter
display symbol
"
STno
"
CoM
"
"
SCC
Parameter name
" (STno)
" (CoM)
" (SCC)
–Data length8 bits Fixed (cannot be changed)Set the master and all of the slaves with the
–Stop bit1 bitFixed (cannot be changed)
Station No.10 to 255Unit does not respond to communication when 0
This is the procedure to specify communications
speed and parity check.
Set the master and all of the slaves with the
same settings.
same settings.
The parameters do not need to be set. Set the loader software (master) with the following settings.
•
Communication speed: 9600 bps
•
Parity: none
– 16 –
Parameter Setting Procedure
The following steps explain how to change the settings to station number "3", parity setting "9600bps/none", and communication
permissions "read and writable" as an example.
Press and hold the key to display "Mv1".
1
The MV1 of the monitoring screen is displayed.
Press and hold the key to display the setup mode operation
2
menu
("
oPE Ch 1
The communication menu is displayed.
(Note) If your micro controller does not have a communication function, "
model.
Press and hold the key, the use the keys to display
3
"STno."
The station number is displayed.
Press the key, then use the keys to set station
4
number to "3" when the bottom part of the display begins to blink.
This sets the parameter to "3".
Press the key to confirm the setting.
"), then use the keys to display "
CoM Ch 9
5
Use the keys to select the parity setting ("CoM").
6
Press the key, then use the keys to set the parity
7
setting to "96no" when the bottom part of the display begins to
blink.
The baud rate/parity setting is set to "9600 bps/none".
".
CoM Ch 9
Chapter
4
" will not be displayed. Please check with your
Press the key to confirm the setting.
8
Use the keys to select the communication permissions
9
("SCC").
Press the key, then use the keys to set the
10
communication permissions to "rW" when the bottom part of the
display begins to blink.
"read/write" is selected.
Press the key to confirm the setting.
11
– 17 –
Chapter
4
Press the key to return to the operation mode PV/SV display.
12
Turn the power to the micro controller off and on again.
13
The changes to the communication parameters become effective after
the power turns off and on again.
– 18 –
Chapter 5
MODBUS Communication Protocol
Overview – 20
●
Message Composition – 21
●
Calculating Error Check Code (CRC-16) – 24
●
Transmission Control Steps – 25
●
Precautions when Writing Data – 26
Chapter
5
– 19 –
Overview
The communication system with the MODBUS protocol always operates using a method where the master first sends a command
message and the applicable slave replys with a response message .
The following describes the communication steps.
Master sends the command
message for the slave.
The slave checks whether the station
number in the received message is
the same as its own station number.
When it’s the sameWhen it’s not the same
Chapter
5
The slave runs the command and
sends a response message.
The slave throws out the received
message and waits for the next
command message. (No reply.)
● When the station number in the command message is the same as the unit’s station number
MasterSlave
Command Message
Station number is the same
Response Message
● When the station number in the command message is not the same as the unit’s station number
MasterSlave
Command Message
Station number is not the same
The master can communicate with an individual slave when multiple slaves are connected on the same circuit by the station
number specified in the master’s command message.
– 20 –
Message Composition
The command message and response message are composed of four parts: the station number, function code, data part, and
error check code. These four parts are sent in that order.
Field nameNo. of bytes
Station No.1 byte
Function Code1 byte
Data Part2 to 125 bytes
Error Check Code (CRC-16)2 bytes
The following describes each part of the message.
Station No.
This is the number specifying the slave. Commands can only be processed by slaves that have the same value set in the "STno"
parameter.
Refer to
For more about setting the "STno" parameter, see "Chapter 4,
Setting Communication Parameters" (p. 15).
Function Code
Chapter
5
This code specifies the function for the slave to perform.
Refer to
For more about function codes, see "Function Code" (p. 23).
Data Part
This data is required to run the function code. The composition of the data part is different depending on the function code.
Refer to
See "Chapter 6, Command and Transmission Frame Details"
(p. 27).
The data in the micro controller is assigned a coil number or resistor number. This coil number or resistor number is specified
when the data is read or written through communication.
The coil number or resistor number used by the message employs a relative address.
The relative address is calculated using the following formula.
Relative address = (last four digits of the coil number or resistor number) – 1
(Ex.) When a function code specifies resistor number "40003"
Relative address= (the last four digits of 40003) – 1
= 0002
is used in the message.
Error Check Code
This code detects whether there are errors (changes in the bits) during the signal transmission processes. MODBUS protocol
(RTU mode) uses CRC-16 (Cyclic Redundancy Check).
Refer to
For more about calculating CRC, see Section 5,
"Calculating Error Check Code (CRC-16)" (p. 24).
– 21 –
Chapter
5
Slave Response
■ Normal Slave Response
The slave creates and replies with a response message for each command message. The response message has the same
format as the command message.
The contents of the data part are different depending on the function code.
Refer to
See "Chapter 6, Command and Transmission Frame Details".
■ Irregular Slave Response
If there are problems (such as specification of a nonexistent function code) with the contents of the command message other than
transmission error, the slave creates and replies with an error response message without following the command.
The composition of the error response message uses the value of the function code in the command message plus 80
below.
Field nameNo. of bytes
Station No.1 byte
Function Code
Faulty function codeA nonexistent function code was specified. Please check the function code.
Faulty address for coil or resistorThe specified relative address for the coil number or resistor number cannot be
used by the specified function code.
Faulty coil or resistor numberThe specified number is too large and specifies a range that does not contain
coil numbers or resistor numbers.
H, as seen
■ No Response
In the following situations, the slave will ignore the command message and not send a response message.
• The station number specified by the command message is not the same as the slave’s specified station number.
• The error check code does not correspond, or a transmission error (such as parity error) is detected.
• The interval between the data comprising the message is empty for more than 24 bit time.
Refer to
See Section 5 "Transmission Control Steps" (p. 25).
• The slave station number is set to "0".
– 22 –
Function Code
For MODBUS protocol, coil numbers or resistor numbers are assigned by the function code, and each function code
only works for the assigned coil number or resistor number.
The correspondence between the function code and the coil number or resistor number is as follows.
Function Code
Coil Number, Resistor Number
CodeFunctionTargetNumberContents
Read (continuous) Input relay1xxxxRead bit data
02
H
03
Read (continuous) Hold resistor3xxxxRead word data
H
04
Read (continuous) Input resistor
H
WriteHold resistor
H
10
Write (continuous) Retention resistor
H
4xxxxRead/write word data06
The message length for each function is as follows.
[unit: byte]
*
*
*
*
*
CodeContents
02
03
04
06
10
Read bit data (read-only)8 bit
H
Read word data60 words
H
Read word data (read-only)37 words
H
Write word data1 word8888
H
Continuously write word data60 words
H
Assignable
Data Number
1
Command MessageResponse Message
MinimumMaximumMinimumMaximum
8866
1
1
1
887125
88779
1112988
1:"Assignable Data Number" above is limited by the data number that the micro controller assigned to the coil number or
address number.
(Excluding function code 06
H
).
Chapter
5
– 23 –
Chapter
5
Calculating Error Check Code (CRC-16)
CRC-16 is a 2-byte (16-bit) error check code. The calculation r ange extends from the start of the message (station number) to the
end of the data part.
The slave calculates the CRC of the received message and ignores the message if this value is not the same as the received
CRC code.
CRC-16 is calculated as follows.
Start
* Description of Variables
Set CR to FFFF
Exclusive-or (XOR) runs on each character of J (one byte) for CR
and the specified message, and sets that result to CR.
After CR has been adjusted one bit to the right, A001
run and set that result to CR.
Add 1 to K
NO
NO
Has calculation
finished 8 times ?
J > 8
YES
Add 1 to J
Has every character
been calculated ?
J > Number of characters
NO
H and XOR
(Calculations occur in the order
command message station number,
function code, and data.)
Adjust CR one bit
to the right.
YES
Complete
The CR calculation result is added
onto the end of the command
message in LOW or HIGH order.
– 24 –
Transmission Control Steps
Master Communication Method
Start communication from the master while following the rules below.
1. The command message, must be sent after an empty space of at least 48 bit time.
2. The interval between each byte in a command message should be less than 24 bit time.
3. After sending a command message, for less than 24 bit time the master will enter receiving standby.
4. After receiving the response message, the next command message must be sent after at least 48 bit time. (Similar to #1.)
5. For safety reasons, create a framework where the master checks the response message, and if there is no response or an
error occurs, retry at least three times.
Caution
The definitions written above are for the minimum required value. For safety reasons, we recommend creating a
master side program that keeps margins two to three times as large. For a concrete example, with 9600 bps, we
recommend programming a blank state (#1 above) of at least 10ms, and the interval between bytes (#2 above) and
switching time from sending to receiving (#3 above) within 1 ms.
Explanation
■
Frame Detection
This communication system uses a two-wire RS-485 interface, and the circuit can therefore enter one of the following two states.
Empty state (no data on the circuit)
•
•
Communication state (data running on the circuit)
The units connected on the circuit start in receiving state and monitor the circuit. When a blank state appears on the circuit for at least
24 bit time, the unit detects the end of the previous frame, and within the next 24 bit time, enters receiving standby. When data
appears on the circuit, the unit begins receiving data, and once another blank state of at least 24 bit time is detected, that frame is
ended. In other words, the data on the circuit from the first time that a 24 bit time blank state appears to the second time one appears
is loaded as one frame (a bundle of data). Therefore, one frame (command message) must be sent while following the rules below.
Before sending the command message, leave an empty space of at least 48 bit time.
•
•
The interval between each byte in a command message should be less than 24 bit time.
■
Micro controller Response
After the micro controller detects the frame (detects blank states at least 24 bit time long), that frame is used to send a command
message. When a command message is sent locally, the response message is returned, but the processing time is about 1 to 30
ms. (The time may change depending on the contents of the command message. ) Therefore, one frame (command message)
must be sent while following the rules below.
•
After sending a command message, for less than 24 seconds the master will enter receiving standby.
Master
POL1
Slave
Chapter
5
Interval of at least 5ms required
(at least 10ms recommended)
1 to 30ms
POL1 response data
POL2
1 to 30ms
POL2 response data
– 25 –
Chapter
5
Precautions when Writing Data
PXG contains internal nonvolatile memory (EEPROM) that is used to save the setting parameters. The data written to the
nonvolatile memory (EEPROM) remains even after the power for PXG is turned off. Parameters that are written via
communication are automatically saved in the internal nonvolatile memory (EEPROM). However, please note that there are two
limitations as follows.
Caution
1. There is a limit to the number of times that data can be transferred to the nonvolatile memory (EEPROM)
(100,000 times). Data cannot be guaranteed if written more than 100,000 times.
Be careful not to transfer unnecessary data when writing data via communication.
In particular, when constructing a communication system with master POD (such as a touch panel), make sure
that the POD writing and trigger settings are appropriate.
Avoid writing at fixed cycles.
2. Writing to the nonvolatile memory (EEPROM) takes several milliseconds. If the power for PXG is turned off
during this operation, the data saved to the nonvolatile memory (EEPROM) may be corrupted.
Wait several seconds after writing data before turning off the power.
In particular, when writing data in a cycle from master device, there is a greater danger of the writing timing and
power shutoff timing coinciding.
Avoid writing at fixed cycles.
– 26 –
Chapter 6
Command and Transmission Frame
Details
Reading Data – 28
●
Writing Data – 34
Chapter
6
– 27 –
Reading Data
Reading Read-Only Bit Data (Function Code: 02H)
The unit reads bit data continuously for the specified number of bits from the first number to start reading from.
The slaves systematically send the read data in 8-bit units.
Caution
Function Code02H
Max. No. of Bits to Read in One Message8 bits
Relative Address0000H to 000CH
Coil Number10001H to 10013H
Message Composition
When the number of bits to be read is not a multiple of eight, unrelated bits (on the MSB side) all become "0".
Chapter
6
Command Message (bytes)
Station No.
Function Code
Number to Start Reading
(Relative Address)
No. of Bits to Read
CRC Data
■
Bit Data to Read List
MSBLSB
00000000
State of last 1 bit
Upper
Lower
00H
Lower
Upper
Lower
MasterSlave
State of first 1 bit
Reply Message Composition (bytes)
Station No.
Function Code
No. of Bytes to Read (01H)
State of first 8 bits
CRC Data
Upper
Lower
– 28 –
Example of Transmitting a Message
This following example explains how to read ALM1 and ALM2 on station number 31.
• ALM1 detection data bit Relative address: 0000H Data number: 2H
• ALM2 detection data bit Relative address: 0001H
Command Message (bytes)
Station No.1FH
Function Code02H
No. to Start Reading
(Relative Address)
No. of Bits to ReadUpper 00H
CRC DataUpper FAH
■
Meaning of Read Data
Upper 00H
Lower 00H
Lower 02H
Lower75H
MSBLSB
00000001
ALM2 OFF state
MasterSlave
ALM1 ON state
Response Message (bytes)
Station No.1FH
Function Code02H
No. of Bytes to Read01H
State of first 8 bits01H
CRC DataUpper66H
Lower60H
Chapter
6
– 29 –
Reading Word Data (Function Code: 03H)
The unit reads word data continuously for the specified number of words from the first number to start reading from.
The slave forwards the read word data from the upper number of bytes to the lower number.
Function Code03H
Max. No. of Words to Read in One Message60 words
Relative Address0000H to 0276H03E8H to 065EH
Resistor Number40001 to 4062841001 to 41628
Contents
Message Composition
Internal Calculation
Value
Engineering Unit
Chapter
6
Command Message Composition
(bytes)
Station No.
Function Code
No. to Start Reading
(Relative Address)
No. of Words to Read
(1 to 60 words)
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
MasterSlave
Reply Message Composition (bytes)
Station No.
Function Code
No. of Bytes to Read
(No. of Words to Read x 2)
First Word Data
Contents
Next Word Data
Contents
Last Word Data
Contents
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
Upper
Lower
■
Meaning of Read Word Data
MSBLSB
First Word Data upper byte
First Word Data lower byte
Next Word Data upper byte
Next Word Data lower byte
Last Word Data upper byte
Last Word Data lower byte
– 30 –
Example of Transmitting a Message (For Engineering Unit)
The message is composed as follows when reading the PV input lower limit and PV input upper limit from station number 2.
If Decimal Point Position = 0, then the PV input upper limit and lower limit are as follows.
PV Lower Limit = 0°C
PV Upper Limit = 400°C
For more about the internal calculation value, engineering unit,
Refer to
and decimal point see
"Chapter 7, Address Map and Data Format" (p. 39).
– 31 –
Reading Read-Only Word Data (Function Code: 04H)
The unit reads word data continuously for the specified number of words from the first number to start reading from.
The slave forwards the read word data from the upper number of bytes to the lower number.
Function Code04H
Max. No. of Words to Read in One Message37 bytes
Relative Address0000H to 0064H03E8H to 044CH
Resistor Number30001 to 3010031001 to 31100
ContentsInternal Calculation Value Engineering Unit
Message Composition
Chapter
6
Command Message Composition
(bytes)
Station No.
Function Code
No. to Start Reading
(Relative Address)
No. of Words to Read
(1 to 15 words)
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
MasterSlave
Reply Message Composition (bytes)
Station No.
Function Code
No. of Bytes to Read
(No. of Words to Read x 2)
First Word Data
Contents
Next Word Data
Contents
Last Word Data
Contents
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
Upper
Lower
■ Meaning of Read Word Data
MSBLSB
First Word Data upper byte
First Word Data lower byte
Next Word Data upper byte
Next Word Data lower byte
Last Word Data upper byte
Last Word Data lower byte
– 32 –
Example of Transmitting a Message (Internal Calculation Data)
The message is composed as follows when reading the PV input value from station number 1.
• PV value relative address: 0000H Number of data: 01H
Station No.01H
Function Code04H
No. of Bytes to Read02H
First Word Data
Contents
CRC Data
■ Meaning of Read Data
Word Data Contents 01 4FH = 335
When the decimal point position = 1
PV = 33.5°C
For more about the internal calculation value, engineering unit,
Refer to
and decimal point see
"Chapter 7, Address Map and Data Format" (p. 39).
Upper01H
Lower 4FH
Upper F9H
Lower 54H
– 33 –
Chapter
6
Writing Data
Writing Word Data (1 word, function code: 06H)
This writes the specified data to the specified number for word data. The master sends the data to be written from the upper
number of bytes to the lower number.
Function Code06H
Max. No. of Bits to Read in One Message1 words
Relative Address0001H to 0274H03E9H to 065CH
Resistor Number40002 to 4062841002 to 41628
ContentsInternal Calculation
Value
Message Composition
MasterSlave
Command Message Composition
(bytes)
Station No.
Function Code
Specified Write Number
(Relative Address)
Word Data to Write
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
Engineering Unit
Response Message Composition
(bytes)
Station No.
Function Code
Specified Write
Number
(Relative Address)
Word Data to
Write
CRC Data
Upper
Lower
Upper
Lower
Upper
Lower
– 34 –
Example of Transmitting a Message
This example explains how to set PID parameter "P" to 100.0 (1000D = 03E8H) on station number 1.
Parameter "P" relative address:0005H (internal calculation value table)
03EDH (initial value table)
MasterSlave
Command Message (bytes)
Station No.01H
Function Code06H
Specified Write
Number
(Relative Address)
Word Data to Write
CRC Data
Upper 00H
Lower 05H
Upper03H
Lower E8H
Upper99H
Lower75H
Response Message (bytes)
Station No.01H
Function Code06H
Specified Write
Number
(Relative Address)
Write Specification
State
CRC Data
Upper00H
Lower 05H
Upper 03H
Lower E8H
Upper 99H
Lower 75H
Chapter
6
Point
For more about the internal calculation value, engineering unit, and decimal point see "Sent Data Format" (p. 40).
– 35 –
Chapter
Writing Continuous Word Data (Function code: 10H)
This writes continuous word information for a number of written words from the first number for writing.
The master sends the data to be written from the upper number of bytes to the lower number.
Function Code10H
Max. No. of Bits to Read in One Message60 words
Relative Address0000H to 0077H03E8H to 045FH
Resistor Number40001 to 4012041001 to 41120
ContentsInternal Calculation
Value
Message Composition
MasterSlave
Engineering Unit
6
Command Message Composition (bytes)
Station No.
Function Code
Specified Write
Number (Relative
Address)
No. of Words to Write Upper
No. of Bytes to Write
First Word Data to
Write
Next Word Data to
Write
Last Word Data to
Write
CRC DataUpper
Upper
Lower
Lower
Upper
Lower
Upper
Lower
Upper
Lower
Lower
}
1 to 60
} No. of Words
to Write x 2
Reply Message Composition (bytes)
Station No.
Function Code
Specified Write
Number (Relative
Address)
No. of Words to
Write
CRC DataUpper
Upper
Lower
Upper
Lower
Lower
■ Meaning of Read Word Data
MSBLSB
First Word Data upper byte
First Word Data lower byte
Next Word Data upper byte
Next Word Data lower byte
Last Word Data upper byte
Last Word Data lower byte
– 36 –
Example of Transmitting a Message (Internal Calculation Data)
The message is composed as follows when writing the following PID parameters to station number 1.
P = 100.0 (= 1000D = 03E8H)
I = 10 (= 100D = 0064)
D = 5.0 (= 50D = 0032H)
•Parameter “PPPP” relative address: 0005H, Data number: 03H
The decimal point cannot be included in the sent data, so data such as “100.0” above is sent as “1000”.
For each type of send data format, see “Chapter 7, Address
Map and Data Format” (p. 39).
– 37 –
Chapter
6
MEMO
– 38 –
Chapter 7
Address Map and Data Format
Data Format – 40
●
Internal Calculation Value Data Address Map – 42
Chapter
7
– 39 –
Data Format
Sent Data Format
The MODBUS protocol used by this equipment employs RTU (Remote Terminal Unit) mode. The data is sent as "numerical
value", not as ASCII code.
Internal Calculation Value and Engineering Unit
In this unit, parameter data and data dependent on an input range can handle the following two types of data.
Internal Calculation Value: Values listed as percentages of the input range (0.00 to 100.00, without decimal point)
Engineering Unit: Values subjected to scaling to actual values depending on the input range
"Engineering Unit" data is handled as the address (resister number) of 1000 added to the address (resister number) for "Internal
Calculation Value".
(Ex.) The value is calculated as follows when the full scale is 400°C and the PV value is "150".
Data not dependent on an input range the same data in both addresses.
Also, bit data cannot be handled in this manner. (Not effective for addresses with 1,000 added.)
Refer to
For more about data dependent on an input range, see
"Chapter 7 Address Map and Data Format" (page 39).
Caution
(Ex.) When changing the input range from 0 to 400 to 0.0 to 400.0
■ Operating the keys on the front of the equipment
Change the position of the decimal point ("PP
PPvvvvdddd
"PP
■ Changing by communication
Set the decimal position parameter ("PP
upper limit ("PP
PPvvvvdddd
"PP
PPvvvvbbbb
"PP
PPvvvvFFFF
"PP
Pay attention to the position of the decimal point when changing the input range by writing with communication. When
changing the position of the decimal point by writing with communication, change the lower limit and upper limit of the
input range at the same time.
" = 0 → 1 (or 2)
PPvvvvFFFF
").
" = 0 → 1
" = 0 → 0
" = 400 → 4000
PPvvvvdddd
") in the setup menu ("SS
PPvvvvdddd
"), as well as the corresponding values for PF input lower limit ("PP
SSEEEETTTT CCCChhhh 6666
").
PPvvvvbbbb
") and PV input
Managing the Decimal Point
Some of the internally stored data may contain may digits lower than the decimal point on the front displa y. Also, the decimal point
is not added to sent data.
Carry out processes for the decimal point position (erasing the decimal point when sending data and adding the decimal point
when receiving data).
Attention must be paid to the position of the decimal point for data where the parameters are dependent on a range in "Chapter 7
Address Map and Data Format". Refer to Address Map.
– 40 –
Data during Input Error
For situations such as overrange, underrange, and input breaks where "UU
becomes 105% or -5% of the input range.
Input errors can be detected via communication using "resistor number 30008 (or 31008): Input/Unit Error Status".
UUUUUUUUUUUUUU
" or "LL
LLLLLLLLLLLLLL
" display on the front, read PV value
Written Data
When writing data to each parameter, set that written data within the range for the data. PXG can accept written data outside of
the range, but do so with care as correct operations are not guaranteed.
Addresses Not Written
Do not write to addresses that are not public. Doing so may cause damage.
Chapter
7
– 41 –
Internal Calculation Value Data Address Map
Handles data dependent on an input range as an internal value before scaling (0.00 to 100.00%).
See "Operation Manual" for more details about individual parameter functions and settings ranges.
Bit Data (read only): function code [02 (H)]
Chapter
7
Relative
address
0000H10001bitDO1 OUTPUT
00001H10002bitDO2 OUTPUT
00002H10003bitDO3 OUTPUT
00003H10004bitDO4 OUTPUT
00004H10005bitDO5 OUTPUT
00008H10009bitDO1 Lamp
00009H10010bitDO2 Lamp
0000AH10011bitDO3 Lamp
0000BH10012bitDO4 Lamp
H10013bitDO5 Lamp
0000C
Coil
Number
Type
Memory
contents
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
ON/OFF
Read data
0: DO1 OFF
1: DO1 ON
0: DO2 OFF
1: DO2 ON
0: DO3 OFF
1: DO3 ON
0: DO4 OFF
1: DO4 ON
0: DO5 OFF
1: DO5 ON
0: DO1 Lamp OFF
1: DO1 Lamp ON
0: DO2 Lamp OFF
1: DO2 Lamp ON
0: DO3 Lamp OFF
1: DO3 Lamp ON
0: DO4 Lamp OFF
1: DO4 Lamp ON
0: DO5 Lamp OFF
1: DO5 Lamp ON
Dependent
on range
Remarks/
related
parameters
– 42 –
Word Data (read/write): function code [03 (H), 06 (H), 10 (H)]
Pid0
1: Pid1 (PID group No. 1)
2: Pid2 (PID group No. 2)
3: Pid3 (PID group No. 3)
4: Pid4 (PID group No. 4)
5: Pid5 (PID group No. 5)
6: Pid6 (PID group No. 6)
7: Pid7 (PID group No. 7)
8: di (PID group Di selection)
AAAALLLL11
"
AAAALLLL1111LL
"
AL1ALM1 set value or A1-L00A2
11
"
AL1LAL1L set valueWord0% to 100% FS (absolute alarm)
LL
"
H
40163 41163 Word0% to 100% FS10°C
-100% to 100 % FS (deviation alarm)
AAAALLLL1111hh
"
AL1hAL1h set value00A3
hh
"
H
40164 41164 Word0% to 100% FS (absolute alarm)
-100% to 100 % FS (deviation alarm)
AAAALLLL22
"
AAAALLLL2222LL
"
AL2ALM2 set value or A2-L00A9
22
"
AL2LAL2L set valueWord0% to 100% FS (absolute alarm)
LL
"
H
40170 41170 Word0% to 100% FS10°C
-100% to 100 % FS (deviation alarm)
AAAALLLL2222hh
"
AL2hAL2h set value00AA
hh
"
H
40171 41171 Word0% to 100% FS (absolute alarm)
-100% to 100 % FS (deviation alarm)
AAAALLLL33
"
AAAALLLL3333LL
"
AL3ALM3 set value or A3-L00B0
33
"
AL3LAL3L set valueWord0% to 100% FS (absolute alarm)
LL
"
H
40177 41177 Word0% to 100% FS10°C
-100% to 100 % FS (deviation alarm)
AAAALLLL3333hh
"
AL3hAL3h set value00B1
hh
"
H
40178 41178 Word0% to 100% FS (absolute alarm)
-100% to 100 % FS (deviation alarm)
Note 1: If SV is changed using the front keys of the equipment and “SVn” is changed via communication at the same time, the SV set from the
front panel may be reflected to the SV number changed via communication.
Chapter
7
– 43 –
Parameter
display
"
"
44
AAAALLLL44
"
LL
AAAALLLL4444LL
Parameter
name
AL4ALM4 set value or A4-L00B7
AL4LAL4L set valueWord0% to 100% FS (absolute alarm)
"
Contents
Relative
address
Resistor Number
Internal
H
40184 41184 Word0% to 100% FS10°C
Engineering
Type
unit
Read data
Written data
range
Factory
Setting
Dependent
on range
-100% to 100 % FS (deviation alarm)
"
AAAALLLL44
AL4hAL4h set value00B8
"
44
h
H
40185 41185 Word0% to 100% FS (absolute alarm)
-100% to 100 % FS (deviation alarm)
"
AAAALLLL55
"
AAAALLLL5555LL
AL5ALM5 set value or A5-L00BE
"
55
AL5LAL5L set valueWord0% to 100% FS (absolute alarm)
"
LL
H
40191 41191 Word0% to 100% FS10°C
-100% to 100 % FS (deviation alarm)
"
AAAALLLL5555hh
AL5hAL5h set value00BF
"
hh
H
40192 41192 Word0% to 100% FS (absolute alarm)
-100% to 100 % FS (deviation alarm)
"
LLLLooooCC
LoCKey lock0027
"
CC
H
40040 41040 Word0 : no lock
1 : all lock
2 : All but SV locked
Note 1: If SV is changed using the front keys of the equipment and “SVn” is changed via communication at the same time, the SV set from the
front panel may be reflected to the SV number changed via communication.
40241 41241 Word0% to 100% FS0% FS
40242 41242 Word0 to 9999 (0.0 to 999.9%)5.0%
40243 41243 Word0 to 32000 (0 to 3200sec)240 sec
40244 41244 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40245 41245 Word0% to 50% FS1°C
40246 41246 Word0 to 1000 (0.0 to 100.0)1.0
40247 41247 Word -5000 to 5000
40251 41251 Word0% to 100% FS0% FS
40252 41252 Word0 to 9999 (0.0 to 999.9%)5.0%
40253 41253 Word0 to 32000 (0 to 3200sec)240 sec
40254 41254 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40255 41255 Word0% to 50% FS1°C
Sv5SV set value 50118
P5Proportional band 50119
i5Integration time 5011A
d5Derivation time 5011B
hYS5
"
CoL5
"
db5Dead band 5011E
ON/OFF control hysteresis 5
Cooling proportional band 5
Relative
address
H
H
H
0108
H
0109
H
H
010B
H
H
H
H
H
H
H
0112
H
0113
H
H
0115
H
H
H
H
H
H
H
011C
H
011D
H
Resistor Number
Internal
Engineering
unit
Type
Read data
Written data
range
Factory
Setting
40263 41263 Word0 to 32000 (0 to 3200sec)240 sec
40264 41264 Word0 to 9999 (0.0 to 999.9sec)60.0 sec
40265 41265 Word0% to 50% FS1°C
40266 41266 Word0 to 1000 (0.0 to 100.0)1.0
40267 41267 Word-5000 to 5000
40271 41271 Word0% to 100% FS0% FS
40272 41272 Word0 to 9999 (0.0 to 999.9%)5.0%
40273 41273 Word0 to 32000 (0 to 3200sec)240 sec
40274 41274 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40275 41275 Word0% to 50% FS1°C
40276 41276 Word0 to 1000 (0.0 to 100.0)1.0
40277 41277 Word-5000 to 5000
40281 41281 Word0% to 100% FS0% FS
40282 41282 Word0 to 9999 (0.0 to 999.9%)5.0%
40283 41283 Word0 to 32000 (0 to 3200sec)240 sec
40284 41284 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40285 41285 Word0% to 50% FS1°C
40286 41286 Word0 to 1000 (0.0 to 100.0)1.0
40287 41287 Word-5000 to 5000
Sv7SV set value 7012C
P7Proportional band 7012D
i7Integration time 7012E
d7Derivation time 7012F
hYS7
"
CoL7Cooling proportional
ON/OFF control hysteresis7
band 7
db7Dead band 70132
bAL7Output convergence
"
value 7
Ar7Anti-reset windup 70134
Relative
address
H
011F
H
H
H
H
H
H
H
0126
H
0127
H
H
0129
H
H
H
H
H
H
H
0130
H
0131
H
H
0133
H
Resistor Number
Internal
Engineering
unit
Type
Read data
40288 41288 Word-10000 to 10000
(-100.0 to 100.0%)
40289 41289 Word
0% to 100% FS
40290 41290 Word0: rv-- (heat (reverse)
Written data
range
/ cool (none))
Factory
Setting
0/50
(single/dual)
100% FS
rv--/rvno
(single/dual)
1: no-- (heat (normal)
/ cool (none))
2: rvno (heat (reverse)
/ cool (normal))
3: norv (heat (normal)
/ cool (reverse))
4: rvrv (heat (reverse)
/ cool (reverse))
5: nono (heat (normal)
/ cool (normal))
40291 41291 Word0% to 100% FS0% FS
40292 41292 Word0 to 9999 (0.0 to 999.9%)5.0%
40293 41293 Word0 to 32000 (0 to 3200sec)240 sec
40294 41294 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40295 41295 Word0% to 50% FS1°C
40296 41296 Word0 to 1000 (0.0 to 100.0)1.0
40301 41301 Word0% to 100% FS0% FS
40302 41302 Word0 to 9999 (0.0 to 999.9%)5.0%
40303 41303 Word0 to 32000 (0 to 3200sec)240 sec
40304 41304 Word0 to 9999 (0.0 to 999.9sec)60.0sec
40305 41305 Word0% to 50% FS1°C
40306 41306 Word0 to 1000 (0.0 to 100.0)1.0
1: Pid1 (PID group No. 1)
2: Pid2 (PID group No. 2)
3: Pid3 (PID group No. 3)
4: Pid4 (PID group No. 4)
5: Pid5 (PID group No. 5)
6: Pid6 (PID group No. 6)
7: Pid7 (PID group No. 7)
8: di (PID group Di
selection)
Factory
Setting
rv--/rvno
(single/dual)
Sv7
Pid7
Dependent
on range
– 48 –
Ramp/Soak (Ch4)
Parameter
display
nn
PPPPTTTTnn
"
"
UU
TTTTiiiiMMMMUU
"
11
SSSSvvvv----11
"
rr
TTTTMMMM1111rr
"
SS
TTTTMMMM1111SS
"
22
SSSSvvvv----22
"
rr
TTTTMMMM2222rr
"
SS
TTTTMMMM2222SS
"
33
SSSSvvvv----33
"
rr
TTTTMMMM3333rr
"
SS
TTTTMMMM3333SS
"
44
SSSSvvvv----44
"
rr
TTTTMMMM4444rr
"
SS
TTTTMMMM4444SS
"
55
SSSSvvvv----55
"
rr
TTTTMMMM5555rr
"
SS
TTTTMMMM5555SS
"
66
SSSSvvvv----66
"
rr
TTTTMMMM6666rr
"
SS
TTTTMMMM6666SS
"
77
SSSSvvvv----77
"
rr
TTTTMMMM7777rr
"
SS
TTTTMMMM7777SS
"
Parameter
name
PTnRamp/Soak Activation
Contents
Pattern
TiMURamp/soak time units0231
"
Sv-1Ramp/Soak
"
1 seg/SV Set Value
TM1rRamp/Soak
"
1 seg ramp time
TM1SRamp/Soak
"
1 seg soak time
Sv-2Ramp/Soak
"
2 seg/SV Set Value
TM2rRamp/Soak
"
2 seg ramp time
TM2SRamp/Soak
"
2 seg soak time
Sv-3Ramp/Soak
"
3 seg/SV Set Value
TM3rRamp/Soak
"
3 seg ramp time
TM3SRamp/Soak
"
3 seg soak time
Sv-4Ramp/Soak
"
4 seg/SV Set Value
TM4rRamp/Soak
"
4 seg ramp time
TM4SRamp/Soak
"
4 seg soak time
Sv-5Ramp/Soak
"
5 seg/SV Set Value
TM5rRamp/Soak
"
5 seg ramp time
TM5SRamp/Soak
"
5 seg soak time
Sv-6Ramp/Soak
"
6 seg/SV Set Value
TM6rRamp/Soak
"
6 seg ramp time
TM6SRamp/Soak
"
6 seg soak time
Sv-7Ramp/Soak
"
7 seg/SV Set Value
TM7rRamp/Soak
"
7 seg ramp time
TM7SRamp/Soak
"
7 seg soak time
Relative
address
0230
0244
0245
0246
0247
0248
0249
024A
024B
024C
024D
024E
024F
0250
0251
0252
0253
0254
0255
0256
0257
0258
Resistor Number
Internal
40561 41561 Word0 (uses steps 1 to 4)
H
Engineering
Type
unit
Read data
Written data
range
1 (uses steps 5 to 8)
2 (uses steps 1 to 8)
3 (uses steps 9 to 12)
4 (uses steps 13 to 16)
5 (uses steps 9 to 16)
6 (uses steps 1 to 16)
7 (according to DI)
1 (PT 100'3f)
2 (J)
3 (K)
4 (R)
5 (B)
6 (S)
7 (T)
8 (E)
9 (no function)
10 (no function)
11 (no function)
12 (N)
13 (PL- 2)
14 (no function)
15 (0V to 5V / 0mA to 20mA
16 (1V to 5V/4mA to 20mA)
17 (0mV to 10V)
18 (2V to 10V)
19 (0mV to 100mV)
40018 41018 Word-1999-99990°C
H
40019 41019 Word-1999-9999400°C
H
40020 41020 Word0 (no decimal point)
H
1 (one decimal place)
2 (two decimal places)
40345 41345 Word0: °C
H
1: °F
40014 41014 Word-10% to 10% FS0% FS
H
40015 41015 Word-5000 to 5000
H
(-50.00% to 50.00% FS)
40022 41022 Word0 to 1200 (0.0 to 120.0 sec)5 sec
H
40099 41099 Word-50% to 50% FS
H
40100 41100 Word-50% to 50% FS
H
40023 41023 Word0: oFF (off)
H
1: on (on)
40118 41118 Word-50% to 50% FS0%FS
H
40119 41119 Word-50% to 50% FS0%
H
40358 41358 Word0: 0-5v (0V to 5V)
H
1: 1-5v (1V to 5V)
40359 41359 Word0.0 sec to 120.0 sec0.0 sec
H
40381 41381 Word0: 0-5v (0V to 5V)
H
1: 1-5v (1V to 5V)
2: 0 to 10 (0V to 10V)
3: 2 to 10 (2V to 10V)
4: 0 to 20 (0mA to 20mA)
5: 4 to 20 (4mA to 20mA)
40382 41382 Word0: 0-5v (0V to 5V)
H
1: 1-5v (1V to 5V)
2: 0 to 10 (0V to 10V)
3: 2 to 10 (2V to 10V)
4: 0 to 20 (0mA to 20mA)
5: 4 to 20 (4mA to 20mA)
This chapter shows a sample program that runs in Microsoft Visual Basic 6.0 (SP6) for reading and writing data.
The program shown here is meant to be used as a reference for your own program creation, and therefore all its actions are not
guaranteed.
Before running the program, check the following summary of points for communication conditions.
•Parity, communication speed to be set in this program. Please match these values with the conditions of the micro controller.
Warning when using an RS-232C to RS-485 converter
The sent data is sometimes added to the response data from the slave bef ore it is receiv ed. In this case, when receiving the data,
process the response data only after first getting rid of the number of bytes from the sent data.
Compatible OS
Windows 2000 Professional
Windows XP Professional Edition
Caution
Fuji Electric Systems Co., Ltd. assumes no responsibility for damages or infringement upon third party rights as a result of using
this sample program.
Use this program while conforming to the contents of the agreement listed within.
• Windows
• Visual Basic
®
is a registered trademark of the Microsoft Corporation.
®
is a registered trademark of the Microsoft Corporation.
Chapter
8
■
Example of data reading
• Operation: Reads and displays 2 word data of the set address at once.
• Function code to be used: 03H, 04H
• Number of read words: 2
' Variable Declaration ***********************************************************************
Dim idx As Integer
Dim Ansdat() As Byte' Response data stack
Dim Rxbuff As Variant' Received data buffer
Dim PauseTime' Sets the communication wait time.
' The necessary wait time changes depending on the
transmission speed and transmission frame length.
Dim Stno As Byte' Communication number
Private Sub Form_Load()
' Initializing the Variable ******************************************************************
Stno = 1
Main.Visible = True
End Sub
'-----------------------------------------'Read continuous words sample program
'Function code : 03H, 04H
'Number of words : 2
'------------------------------------------
Private Sub TX1_Click()
TX1.Enabled = False
– 68 –
' Communication Port Settings ****************************************************************
If Com5.Value = True Then
Comm_port = 5' COM5
ElseIf Com4.Value = True Then
Comm_port = 4' COM4
ElseIf Com3.Value = True Then
Comm_port = 3' COM3
ElseIf Com2.Value = True Then
Comm_port = 2' COM2
Else
Comm_port = 1' COM1
End If
If SPD192.Value = True Then
Comm_speed = "19200,"' 19200bps
ElseIf SPD96.Value = True Then
Comm_speed = "9600,"' 9600bps
Else
Comm_speed = "38400,"' 38400bps
End If
If Even1.Value = True Then
Comm_parity = "E,"' Even parity
ElseIf Odd1.Value = True Then
Comm_parity = "O,"' Odd parity
Else
Comm_parity = "N,"' Parity none
End If
PauseTime = 0.2' Sets the wait time. (0.2 sec)
Chapter
8
idx = 0
' Opening the Communication Port *************************************************************
MSComm1.CommPort = Comm_port' COM port settings
MSComm1.Settings = Comm_speed & Comm_parity & "8,1"' Speed / Party / 8bit_Data / Stop_1bit
MSComm1.PortOpen = True' Port open
' Setting the Communication Number for the Other Party ***************************************
St = Val(Stno1(idx).Text)
Stno = St Mod 256
Stno1(idx).Text = Str(Stno)
' Processing the Address *********************************************************************
' Creating the Send Command ******************************************************************
Select Case Area
Case 3
ReDim Txdat(7) As Byte' Secured 8-byte array
Txdat(0) = Stno' Station No.
Txdat(1) = &H4' Command
Txdat(2) = Adrsh' High address
Txdat(3) = Adrsl' Low address
Txdat(4) = &H0' Read no. words (High)
Txdat(5) = &H2' Read no. of words (Low)
Txsu = 5' No. of sent data
Case 4
ReDim Txdat(7) As Byte' Secured 8-byte array
Txdat(0) = Stno' Station No.
Txdat(1) = &H3' Command
Txdat(2) = Adrsh' High address
Txdat(3) = Adrsl' Low address
Txdat(4) = &H0' Read no. of words (High)
Txdat(5) = &H2' Read no. of words (Low)
Txsu = 5' No. of sent data
Case Else' For other values
MSComm1.PortOpen = False' COM port close
TX1.Enabled = True
Exit Sub
End Select
' Sending the command.************************************************************************
' Creating CRC for Send Data
GoSub 10000' CRC computation
Txdat(Txsu + 1) = CRC1'
Txdat(Txsu + 2) = CRC2'
' Send the created command.
MSComm1.Output = Txdat' Send one byte
' Wait until all of the response data is sent.
Start = Timer' Saves the waiting start time.
Do While Timer < Start + PauseTime' Has the set time passed?
DoEvents' Passes control to other processes.
If ((Start + PauseTime) - Timer) > PauseTime Then
Start = Timer
End If
Loop
– 70 –
' Import the response data into a byte array.
MSComm1.InputMode = comInputModeBinary' Set binary mode
length = MSComm1.InBufferCount' Retrieve the no. of sent data bytes
MSComm1.InputLen = 0' Set retrieval of all data
Rxbuff = MSComm1.Input' Import received data into the received buffer
Ansdat = Rxbuff' Assign received data into the byte array
' Calculating CRC for Received Data
Ansu = length - 3' Received data length
GoSub 20000' CRC computation
10000 ' CRC calculation subroutine IN:Txdat(Txsu) / OUT CRC1,CRC2 ****************************
CRC = &HFFFF
For i = 0 To Txsu Step 1
CRC = CRC Xor Txdat(i)
For J = 1 To 8 Step 1
CT = CRC And &H1
If CRC < 0 Then CH = 1 Else: CH = 0: GoTo 11000
CRC = CRC And &H7FFF
11000CRC = Int(CRC / 2)
If CH = 1 Then CRC = CRC Or &H4000
If CT = 1 Then CRC = CRC Xor &HA001
Next J
Next i
CRC1 = CRC And &HFF
CRC2 = ((CRC And &HFF00) / 256 And &HFF)
Return
20000 ' CRC calculation subroutine IN:Ansdat(Ansu) / OUT CRC1,CRC2 ***************************
CRC = &HFFFF
For i = 0 To Ansu Step 1
CRC = CRC Xor Ansdat(i)
For J = 1 To 8 Step 1
CT = CRC And &H1
If CRC < 0 Then CH = 1 Else: CH = 0: GoTo 21000
CRC = CRC And &H7FFF
21000CRC = Int(CRC / 2)
If CH = 1 Then CRC = CRC Or &H4000
If CT = 1 Then CRC = CRC Xor &HA001
Next J
Next i
CRC1 = CRC And &HFF
CRC2 = ((CRC And &HFF00) / 256 And &HFF)
Return
End Sub
– 72 –
Example of data writing
• Operation: Writes 2 word data of the set address.
• Function code to be used: 10H
• Number of write words: 2
----------------------------------'Write 2 words sample program
'Function code : 10H
'Number of words : 2
'-----------------------------------
Private Sub Write_command_Click()
Write_command.Enabled = False
' Communication Port Settings ****************************************************************
If Com5.Value = True Then
Comm_port = 5' COM5
ElseIf Com4.Value = True Then
Comm_port = 4' COM4
ElseIf Com3.Value = True Then
Comm_port = 3' COM3
ElseIf Com2.Value = True Then
Comm_port = 2' COM2
Else
Comm_port = 1' COM1
End If
If SPD192.Value = True Then
Comm_speed = "19200,"' 19200bps
ElseIf SPD96.Value = True Then
Comm_speed = "9600,"' 9600bps
Else
Comm_speed = "38400,"' 38400bps
End If
If Even1.Value = True Then
Comm_parity = "E,"' Even parity
ElseIf Odd1.Value = True Then
Comm_parity = "O,"' Odd parity
Else
Comm_parity = "N,"' Parity none
End If
PauseTime = 0.2' Sets the wait time. (0.2 sec)
idx = 1
' Opening the Communication Port *************************************************************
MSComm1.CommPort = Comm_port' Com port
MSComm1.Settings = Comm_speed & Comm_parity & "8,1"' Speed / Party / 8bit_Data / Stop_1bit
MSComm1.PortOpen = True' Open com port
■
Chapter
8
– 73 –
Chapter
8
' Setting the Communication Number for the Other Party ***************************************
St = Val(Stno1(idx).Text)
Stno = St Mod 256
Stno1(idx).Text = Str(Stno)
ReDim Txdat(12) As Byte' 13 bytes
Txdat(0) = Stno' Station No.
Txdat(1) = &H10' Command
Txdat(2) = Adrsh' High address
Txdat(3) = Adrsl' Low address
Txdat(4) = &H0' Write no. of words (High)
Txdat(5) = &H2' Write no. of words (Low)
Txdat(6) = &H4' Write no. of bytes
Txdat(7) = byteData(2)' Write data (Lo high)
Txdat(8) = byteData(3)' Write data (Lo lo)
Txdat(9) = byteData(0)' Write data (High high)
Txdat(10) = byteData(1)' Write data (High lo)
Txsu = 10' No. of sent data
Case Else' For other values
MSComm1.PortOpen = False' COM port close
Write_command.Enabled = True
Exit Sub
End Select
– 74 –
' Sending the command. ***********************************************************************
' Creating CRC for Send Data
GoSub 10000' CRC computation
Txdat(Txsu + 1) = CRC1'
Txdat(Txsu + 2) = CRC2'
' Send the created command.
MSComm1.Output = Txdat' Send one byte
' Wait until all of the response data is sent.
Start = Timer' Saves the waiting start time.
Do While Timer < Start + PauseTime' Has the set wait time passed?
DoEvents' Passes control to other processes.
If ((Start + PauseTime) - Timer) > PauseTime Then
Start = Timer
End If
10000 ' CRC calculation subroutine IN:Txdat(Txsu) / OUT CRC1,CRC2 **************************
CRC = &HFFFF
For i = 0 To Txsu Step 1
CRC = CRC Xor Txdat(i)
For J = 1 To 8 Step 1
CT = CRC And &H1
If CRC < 0 Then CH = 1 Else: CH = 0: GoTo 11000
CRC = CRC And &H7FFF
11000CRC = Int(CRC / 2)
If CH = 1 Then CRC = CRC Or &H4000
If CT = 1 Then CRC = CRC Xor &HA001
Next J
Next i
CRC1 = CRC And &HFF
CRC2 = ((CRC And &HFF00) / 256 And &HFF)
Return
End Sub
8
– 75 –
MEMO
Chapter
8
– 76 –
Chapter 9
Troubleshooting
Troubleshooting – 78
Chapter
9
– 77 –
Troubleshooting
Check the following items when the unit cannot communicate.
Is the power turned on to all of the equipment related to communication?
Are the wire connections correct? (Are the + and – poles matching?)
Are the communication settings the same between the master (the top computer) and the slave (micro controller)?
None
Does the transmission signal timing satisfy "Chapter 5, MODBUS Communication Protocol" (p. 19)?
Is the station number specified as the sending location from the master set at something other than "0"?
The communication function does not work when set to "0".
When using RS-485, is the 7th digit of the model number (PXG) any of M, V, K, J, U or F?
When using RS-485, are the communication settings the same for the RS-232C to RS-485 converter?
Chapter
9
– 78 –
International Sales Div
Sales Group
Gate City Ohsaki, East Tower, 11-2, Osaki 1-chome,
Shinagawa-ku, Tokyo 141-0032, Japan
http://www.fujielectric.com
Phone: 81-3-5435-7280, 7281 Fax: 81-3-5435-7425
http://www.fujielectric.com/products/instruments/
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.