User’s Manual Model PR300 Power and Energy Meter Communication Interface (RS-485 and Ethernet Communications) IM 77C01E01-10E IM 77C01E01-10E 4th Edition
i Introduction This user's manual describes the communication functions of the PR300 power and energy meter and contains information on how to create communication programs. Hereafter, the PR300 power and energy meter is simply referred to as the PR300. Read the manual carefully to understand the communication functions of the PR300 . The PR300 has the following communication protocols.
ii Documentation Conventions ■ Symbols This manual uses the following symbols. ● Symbols Used in the Main Text NOTE Draws attention to information that is essential for understanding the operation and/or features of the product. TIP Gives additional information to complement the present topic. See Also Gives reference locations for further information on the topic.
iii Notices ■ Regarding This User's Manual (1) This manual should be passed on to the end user. Keep the manual in a safe place. (2) Read this manual carefully to gain a thorough understanding of how to operate this product before you start using it. (3) This manual is intended to describe the functions of this product. Yokogawa Electric Corporation (hereinafter simply referred to as Yokogawa) does not guarantee that these functions are suited to the particular purpose of the user.
iv ■ Force Majeure (1) Yokogawa does not make any warranties regarding the product except those mentioned in the WARRANTY that is provided separately. (2) Yokogawa assumes no liability to any party for any loss or damage, direct or indirect, caused by the use or any unpredictable defect of the product. (3) Be sure to use the spare parts approved by Yokogawa when replacing parts or consumables. (4) Modification of the product is strictly prohibited.
Toc-1 Model PR300 Power and Energy Meter Communication Interface (RS-485 and Ethernet Communications) IM 77C01E01-10E 4th Edition CONTENTS Introduction........................................................................................................... i Documentation Conventions ...............................................................................ii Notices .................................................................................................................
Toc-2 3.4.5 3.4.6 4. Demand Current Alarm Point .......................................................... 3-14 Demand Alarm Release Function ................................................... 3-15 3.5 Communication Setting ................................................................................ 3.5.1 Protocol .......................................................................................... 3.5.2 Baud Rate ............................................................
Toc-3 4.4 5. 6. 7. 8. Sample Program ........................................................................................... 4-17 4.4.1 Example of BASIC Program for Send and Receive ......................... 4-17 Modbus/RTU and ASCII Communication Protocols 5.1 Overview .......................................................................................................... 5-1 5.1.1 Configuration of Message .................................................................
<1. Communications Overview > 1. Communications Overview 1.1 RS-485 Communication Specifications 1-1 Protocols available for RS-485 communication interfaces include the PC link communication protocol and the Modbus communication protocol. Table 1.
2. <2. Setup> 2-1 Setup This chapter describes how to set up the PR300, which is equipped with RS-485 communication as a standard feature. When using an Ethernet-equipped model, either RS-485 or Ethernet can be selected by parameter setting for communications. For details of use of RS-485 communication, see subsection 2.1.1 “Procedure for RS-485 Communication.” For details of use of the Ethernet communication, see subsection 2.1.2 “Procedure for Ethernet Communication.
2.1.1 <2. Setup> Procedure for RS-485 Communication (Example) Higher-level device Maximum communication distance: 1200 m Maximum number of slave stations to be connected: 31 Station number 01 (arbitrary) 1 Station number 02 (arbitrary) Station number 10 (arbitrary) Station number 20 (arbitrary) Communication parameters setting for PR300 Set up the communication function using the front panel keys. See Subsection 2.2.
2.1.2 <2. Setup> Procedure for Ethernet Communication (Example) Higher-level device IP address [192.168.1.1] (arbitrary) HUB Ethernet Maximum distance between hub and module: 100 m Maximum number of hubs connectable in cascade configuration: 4 levels for 10BASE-T 2 levels for 100BASE-TX LAN connection Station number 01 (fixed) IP address [192.168.1.2] (arbitrary) 1 Station number 01 (fixed) IP address [192.168.1.3] (arbitrary) Station number 01 (fixed) IP address [192.168.1.
2.1.3 <2. Setup> Procedure for Ethernet-Serial Gateway Function (Example) Higher-level device IP address [192.168.1.1] (arbitrary) Ethernet PR300 (with Ethernet communication function) Station number 01 (fixed) IP address [192.168.1.2] (arbitrary) RS-485 Station number 02 (arbitrary) 1 Station number 03 (arbitrary) Station number 20 (arbitrary) Communication parameters setting for PR300 Set up the communication function using the front panel keys. See Subsection 2.2.
<2. Setup> 2-5 ● VJET Ethernet/RS-485 converter as an Ethernet-serial gateway function (Example) Higher-level device IP address [192.168.1.1] (arbitrary) Ethernet VJET* Ethernet/RS-485 converter Station number 01 (fixed) IP address [192.168.1.2] (arbitrary) RS-485 Station number 02 (arbitrary) Station number 03 (arbitrary) Station number 20 (arbitrary) * The VJET is Yokogawa’s converter. For details of use of the VJET, refer to its user’s manual.
2.2 2-6 <2. Setup> Setting Communication Conditions This section describes the setting parameters for using the communication functions, and the setting ranges. For details of setting method, refer to the PR300 Power and Energy Meter User’s Manual (electronic manual). 2.2.1 Conditions for RS-485 Communication This subsection describes the setting parameters for using the RS-485 communication function, and the setting ranges. Table 2.
<2. Setup> 2-7 ● Protocol (COMM) Set the communication protocol identical to that of the higher-level device to be connected. ● Station number (ST-NO) Set the station number of the PR300 itself. A station number of 01 to 99 may be assigned in any order. However, the maximum number of PR300 to be connected to a single communication port is 31. When connecting two or more PR300 to a single communication port, set a different station number to each.
2.2.2 <2. Setup> 2-8 Conditions for Ethernet Communication This subsection describes the setting parameters for using the Ethernet communication function, and the setting ranges. Table 2.
<2. Setup> 2-9 ● Protocol (COMM) Set the protocol to Modbus/TCP. ● IP address-1 to 4 (IP-n) [n: integers from 1 to 4] Set the IP address for the PR300 by the following format. 0 to 255 IP address IP-1 0 to 255 IP-2 0 to 255 IP-3 0 to 255 IP-4 ● Subnet mask-1 to 4 (SM-n) [n: integers from 1 to 4] Set the subnet mask for the PR300 by the following format.
2.2.3 <2. Setup> 2-10 Conditions for Ethernet-Serial Gateway Function The Ethernet-serial gateway function is a function that reads/writes data from/to other devices equipped with RS-485 serial communication function using the Modbus/TCP protocol via the PR300. With this function, the higher-level device can access the devices connected to the RS-485 serial communication line in the same way as to access the devices connected to Ethernet.
2-11 <2. Setup> ● Setting for PR300 to perform the Ethernet-serial gateway function To use the Ethernet-serial gateway function, set the parameters of subsection 2.2.2, “Conditions for Ethernet Communication” and set a parity (PRI) in Table 2.3. When the protocol is set to Modbus/TCP, the parameters of RS-485 other than the parity are fixed and unchangeable. Table 2.
2.3 2-12 <2. Setup> Wiring for Communication Connect a higher-level device with the PR300 for using the communication functions. The wiring procedures and precautionary notes are as follows. 2.3.1 Wiring for RS-485 Communication For a common PC, the RS-485 interface is not directly connectable. Use a ML2 RS232C/ RS485 converter for wiring. WARNING To avoid an electric shock, be sure to turn off the power supply source to the equipment involved before you start wiring.
2.3.2 <2. Setup> 2-13 Wiring for Ethernet Communication To use the Ethernet communication function, connect a higher-level device with the PR300 with Ethernet communication function using 10BASE-T/100BASE-TX. 10BASE-T/ 100BASE-TX are Ethernet connection methods using twisted pair cables. The transmission rates are 10 Mbps/100 Mbps. In 10BASE-T/100BASE-TX networks, higher-level devices such as a PC are connected in a star pattern through a hub.
2.3.3 2-14 <2. Setup> Wiring for RS-485 Communication for Ethernet-Serial Gateway Function To use the Ethernet-serial gateway function, connect other RS-485 serial communication device to the RS-485 communication terminals . WARNING To avoid an electric shock, be sure to turn off the power supply source to the equipment involved before you start wiring. The figure below shows the example of wiring connection for the PR300 with Ethernet communication function.
3. <3. Procedures for Setting PR300 Functions> 3-1 Procedures for Setting PR300 Functions To set the functions of the PR300, use the protocols described in Chapter 4, “PC Link Communication Protocol,” Chapter 5, “Modobus/RTU and ASCII Communication Protocols,” or Chapter 6, “Modbus/TCP Communication Protocol” according to the instructions in this chapter. For details of each function, refer to the PR300 Power and Energy Meter User’s Manual (electronic manual).
<3. Procedures for Setting PR300 Functions> 3.1 Basic Setting 3.1.1 Setting of VT Ratio 3-2 [Procedure] (1) Write a VT ratio to the two D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the setup change status register, D0207. D Register Reference No. H No.
3.1.2 <3. Procedures for Setting PR300 Functions> 3-3 Setting of CT Ratio [Procedure] (1) Write a CT ratio to the two D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the setup change status register, D0207. D Register Reference No. H No.
3.1.3 <3. Procedures for Setting PR300 Functions> 3-4 Setting of Integrated Low-cut Power [Procedure] (1) Write an integrated low-cut power value to the two D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the setup change status register, D0207. D Register D0205 Reference No. 40205 H No. Description 00CC Integrated low-cut power (float, lower 2 bytes) Effective Range 0.05 to 20.
<3. Procedures for Setting PR300 Functions> 3.2 Setting Pulse Output 3.2.1 Selection of Measurement Item for Pulse Output 3-5 [Procedure] (1) Write a measurement item for pulse output value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the pulse output writing status register, D0211. D Register Reference No. H No.
3.2.2 <3. Procedures for Setting PR300 Functions> 3-6 Pulse Unit [Procedure] (1) Write a pulse unit value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the pulse output writing status register, D0211. D Register Reference No. H No.
3.2.3 <3. Procedures for Setting PR300 Functions> 3-7 ON Pulse Width (1) Write an ON pulse width value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the pulse output writing status register, D0211.
<3. Procedures for Setting PR300 Functions> 3.3 Setting Analog Output 3.3.1 Selection of Measurement Item for Analog Output 3-8 [Procedure] (1) Write a measurement item for analog output value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the analog output writing status register, D0217. D Register Reference No. H No.
3.3.2 <3. Procedures for Setting PR300 Functions> 3-9 Upper/Lower Limits of Scaling [Procedure] (1) Write upper/lower limits of scaling value to the four D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the analog output writing status register, D0217. D Register D0213 Reference No. 40213 H No.
<3. Procedures for Setting PR300 Functions> 3.4 Demand Setting 3.4.1 Demand Power/Current 3-10 [Procedure] (1) Write a demand power/current value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register Reference No. H No.
3.4.2 <3. Procedures for Setting PR300 Functions> 3-11 Demand Period [Procedure] (1) Write a demand period value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register Reference No. H No.
3.4.3 <3. Procedures for Setting PR300 Functions> 3-12 Demand Alarm Mask Time [Procedure] (1) Write a demand alarm mask time value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register D0220 Reference No. 40220 H No.
3.4.4 <3. Procedures for Setting PR300 Functions> 3-13 Demand Power Alarm Point [Procedure] (1) Write a demand power alarm point value to the two D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register D0221 Reference No. 40221 H No.
3.4.5 <3. Procedures for Setting PR300 Functions> 3-14 Demand Current Alarm Point [Procedure] (1) Write a demand current alarm point value to the two D registers in the table below. The data type is 4-byte floating point. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register D0223 Reference No. 40223 H No.
3.4.6 <3. Procedures for Setting PR300 Functions> 3-15 Demand Alarm Release Function [Procedure] (1) Write a demand alarm release function value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the demand measurement writing status register, D0226. D Register D0225 D0226 Reference No. 40225 40226 H No.
<3. Procedures for Setting PR300 Functions> 3.5 Communication Setting 3.5.1 Protocol 3-16 [Procedure] (1) Write a protocol value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register Reference No. H No.
3.5.2 <3. Procedures for Setting PR300 Functions> 3-17 Baud Rate [Procedure] (1) Write a baud rate value to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register H No. Reference No.
3.5.3 <3. Procedures for Setting PR300 Functions> 3-18 Parity [Procedure] (1) To set the parity, write data to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register Reference No. H No.
3.5.4 <3. Procedures for Setting PR300 Functions> 3-19 Stop Bit [Procedure] (1) To set the stop bit, write data to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register Reference No. H No.
3.5.5 <3. Procedures for Setting PR300 Functions> 3-20 Data Length [Procedure] (1) To set the data length, write data to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register Reference No. H No.
3.5.6 <3. Procedures for Setting PR300 Functions> 3-21 Station Number [Procedure] (1) To set the station number, write data to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the RS-485 writing status register, D0277. D Register Reference No. H No.
3.5.7 <3. Procedures for Setting PR300 Functions> 3-22 IP Address (for Ethernet communication) [Procedure] (1) To set the IP address, write data to the four D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the Ethernet writing status register, D0294. D Register Reference No. H No.
3.5.8 <3. Procedures for Setting PR300 Functions> 3-23 Subnet Mask (for Ethernet communication) [Procedure] (1) To set the subnet mask, write data to the four D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the Ethernet writing status register, D0294. D Register Reference No. H No.
3.5.9 <3. Procedures for Setting PR300 Functions> 3-24 Default Gateway (for Ethernet communication) [Procedure] (1) To set the default gateway, write data to the four D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the Ethernet writing status register, D0294. D Register Reference No. H No.
<3. Procedures for Setting PR300 Functions> 3-25 3.5.10 Port Number (for Ethernet communication) [Procedure] (1) To set the port number, write data to the D register in the table below. The data type is integer. (2) After writing that value, write 1 to the Ethernet writing status register, D0294. D Register Reference No. H No.
<3. Procedures for Setting PR300 Functions> 3.6 Writing Energy Values 3.6.1 Active Energy 3-26 [Procedure] (1) Write an active energy value to the two D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the writing status register, D0373. D Register Reference No. H No.
3.6.2 <3. Procedures for Setting PR300 Functions> 3-27 Regenerative Energy [Procedure] (1) Write a regenerative energy value to the two D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the writing status register, D0376. D Register Reference No. D0374 40374 H No.
3.6.3 <3. Procedures for Setting PR300 Functions> 3-28 LEAD Reactive Energy [Procedure] (1) Write a LEAD reactive energy value to the two D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the writing status register, D0381. D Register Reference No. H No. D0377 40377 0178 D0378 40378 0179 D0381 40381 017C Description Effective Range LEAD reactive energy-setpoint (lower 2 bytes) Refer to the "NOTE" below.
3.6.4 <3. Procedures for Setting PR300 Functions> 3-29 LAG Reactive Energy [Procedure] (1) Write a LAG reactive energy value to the two D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the writing status register, D0381. D Register Reference No. H No. D0379 40379 017A D0380 40380 017B D0381 40381 017C Description Effective Range LAG reactive energy-setpoint (lower 2 bytes) Refer to the "NOTE" below.
3.6.5 <3. Procedures for Setting PR300 Functions> 3-30 Apparent Energy [Procedure] (1) Write an apparent energy value to the two D registers in the table below. The data type is integer. (2) After writing that value, write 1 to the writing status register, D0384. D Register Reference No. D0382 40382 H No. Description 017D Apparent energy-setpoint (lower 2 bytes) Effective Range Refer to the "NOTE" below.
<3. Procedures for Setting PR300 Functions> 3.7 Executing Reset Operations 3.7.1 Remote Reset 3-31 [Procedure] (1) To execute remote reset, write data to the D register in the table below. The data type is integer. D Register Reference No. D0400 40400 H No.
3.7.2 <3. Procedures for Setting PR300 Functions> 3-32 Maximum/Minimum Values Reset [Procedure] (1) To execute maximum/minimum values reset, write data to the D register in the table below. The data type is integer. D Register Reference No. D0351 40351 H No.
3.7.4 <3. Procedures for Setting PR300 Functions> 3-33 Active Energy Reset [Procedure] (1) To execute active energy reset, write data to the D register in the table below. The data type is integer. D Register Reference No. D0353 H No.
3.7.6 <3. Procedures for Setting PR300 Functions> 3-34 Reactive Energy Reset [Procedure] (1) To execute reactive energy reset, write data to the D register in the table below. The data type is integer. D Register Reference No. D0355 40355 H No.
3.8 3.8.1 <3. Procedures for Setting PR300 Functions> 3-35 Setting Control States Integration Start/Stop [Procedure] (1) To execute integration start/stop, write data to the D register in the table below. The data type is integer. D Register Reference No. H No.
3.8.2 3-36 <3. Procedures for Setting PR300 Functions> Optional Integration Start/Stop [Procedure] (1) To execute optional integration start/stop, write data to the D register in the table below. The data type is integer. D Register Reference No. D0302 40302 H No.
3.8.3 3-37 <3. Procedures for Setting PR300 Functions> Demand Measurement Start/Stop [Procedure] (1) To execute demand measurement start/stop, write data to the D register in the table below. The data type is integer. D Register Reference No. H No.
3.8.4 <3. Procedures for Setting PR300 Functions> 3-38 Confirmation and Release of Demand Alarm State [Procedure] (1) To execute confirmation and release of demand alarm state, write data to the D register in the table below. The data type is integer. D Register Reference No. D0312 40312 H No.
<4. PC Link Communication Protocol> 4. PC Link Communication Protocol 4.1 Overview 4-1 The use of PC link communication enables the PR300 to communicate with a device such as a PC or FA-M3(PLC)'s UT link module. Such a device can be used in communication to read/write data from/to D registers which are internal registers of the PR300.
4.1.1 4-2 <4. PC Link Communication Protocol> Configuration of Command Commands sent from a higher-level device to the PR300 consist of the following elements. Number of Bytes 1 2 2 Element STX Station number (ST-NO) CPU number 01 (1) (2) (3) 1 3 Time to wait Command for response 0 (4) (5) Variable length 2 1 1 Data corresponding to command Checksum ETX CR (6) (7) (8) (9) (1) STX (Start of Text) This control code indicates the start of a command.
4-3 <4. PC Link Communication Protocol> (8) ETX (End of Text) This control code indicates the end of a command string. The ASCII code is 03 in hexadecimal. (9) CR (Carriage Return) This control code indicates the end of a command. The ASCII code is 0D in hexadecimal. NOTE The control codes “STX”, “ETX”, and “CR” are essential for commands when you create a communication program for PC link communication. Omission of any of them or incorrect order of them results in communication failure. 4.
4.1.3 <4. PC Link Communication Protocol> 4-4 Response Error Codes See Also 4.1.2, “Configuration of Response”, for the configuration of response in the event of error. The error codes (EC1) and detailed error codes (EC2) of responses are as follows. Table 4.
4.1.4 <4. PC Link Communication Protocol> 4-5 Specifying Broadcast The corresponding multiple PR300 perform the function to receive and process a command in which this station number is specified. (1) Specify “P1” for the station number in the command to execute it. (2) This command works independently of station numbers of slave stations (01 to 99). (3) This command is applicable for writing only. (4) No response is returned from the PR300 when communication is performed using this command.
4.2 <4. PC Link Communication Protocol> 4-6 Command and Response The following shows the lists of commands available in PC link communication. The details of them are explained in the description of each command.
WRD 4-7 <4. PC Link Communication Protocol> Reads D registers on a word-by-word basis ● Function This function code reads a sequence of contiguous register information on a word-by-word basis by the specified number of words, starting with a specified register number. • The number of words to be read at a time is 1 to 64. • For the format of response in the event of failure, see subsection 4.1.2. • The command shown below includes the checksum function.
4-8 <4. PC Link Communication Protocol> WWR Writes data into D registers on a word-by-word basis ● Function This function code writes information into a sequence of contiguous registers on a word-byword basis by the specified number of words, starting with a specified register number. • The number of words to be written at a time is 1 to 64. • For the format of response in the event of failure, see subsection 4.1.2. • The command shown below includes the checksum function.
WRR 4-9 <4. PC Link Communication Protocol> Reads D registers on a word-by-word basis in random order ● Function This function code reads the statuses of the individual registers, on a word-by-word basis, specified in a random order by the specified number of words. • The number of words to be read at a time is 1 to 32. • For the format of response in the event of failure, see subsection 4.1.2. • The command shown below includes the checksum function.
4-10 <4. PC Link Communication Protocol> WRW Writes data into D registers on a word-by-word basis in random order ● Function This function code writes register information specified for each register into the registers specified in a random order by the specified number of words. • The number of words to be written at a time is 1 to 32. • For the format of response in the event of failure, see subsection 4.1.2. • The command shown below includes the checksum function.
WRS 4-11 <4. PC Link Communication Protocol> Specifies the D registers to be monitored on a word-by-word basis ● Function This function code specifies the register numbers to be monitored on a word-by-word basis. Note that this command simply specifies the registers. Actual monitoring is performed by the WRM command after the register numbers are specified by this command.
4-12 <4. PC Link Communication Protocol> WRM Monitors the D registers on a word-by-word basis ● Function This function code reads the information of the registers that have been specified in advance by the WRS command. • Before executing this command, the WRS command must always be executed to specify which registers are to be monitored. If no register has been specified, error code 06 is returned. • For the format of response in the event of failure, see subsection 4.1.2.
INF6 <4. PC Link Communication Protocol> Reads the model, suffix codes, and version information ● Function This function code reads the model, suffix codes, and version number of the PR300. • For the format of response in the event of failure, see subsection 4.1.2.
INF7 <4. PC Link Communication Protocol> 4-14 Reads the maximum value of CPU ● Function This function code refurns the maximum value of CPU of a station in PC link communication. • For the format of response in the event of failure, see subsection 4.1.2.
4.3 <4. PC Link Communication Protocol> 4-15 Communication with Higher-level Devices Higher-level devices are those capable of using the PC link communication protocol. 4.3.1 Communication with FA-M3 (UT Link Module) Communication with FA-M3 is achieved by simply connecting the PR300 to a UT link module using the PC link communication protocol. Set the communication conditions of the PR300 identical to those of the UT link module.
<4. PC Link Communication Protocol> 4-16 FA-M3's UT Link Module Setup Procedure (Example) This section explains the procedure for setting up the FA-M3's UT link module when the “Automatic mode” is used. (1) Setting Up the UT Link Module Before following the procedure, always make sure that the FA-M3's UT link module is turned off. Then, open the inner cover and follow the setup steps described below. Configure the DIP switch of the UT link module as shown below: Switch No.
<4. PC Link Communication Protocol> 4.4 Sample Program 4.4.1 Example of BASIC Program for Send and Receive 4-17 This section shows an example of a command sending and response receiving program created with F-BASIC*2 for PC/AT*1 (or compatible machines). *1 PC/AT is the product of IBM Ltd. *2 F-BASIC is the product of Fujitsu Ltd. Example of the Program Created Using F-BASIC Version 6.
<4. PC Link Communication Protocol> 4-18 ‘=== Subroutine === *RECEIVECHR ‘Interruption processing during receiving interval off ‘Start timer RCVCHR$=RCVCHR$+input$(lof(#1),#1) ‘Fetch character string from receive buffer.
<5. Modbus/RTU and ASCII Communication Protocols> 5-1 5. Modbus/RTU and ASCII Communication Protocols 5.1 Overview The use of Modbus communication enables the PR300 to communicate with a device such as a PC or PLC (sequencer). Such a device can be used in communication to read/write data from/to D registers which are internal registers of the PR300. Hereafter, PCs are generically called “higher-level devices.
<5. Modbus/RTU and ASCII Communication Protocols> 5-2 For Modbus communication with the PR300, we provide the ASCII mode and RTU mode (binary system) for the transmission mode. Table 5.1 ASCII and RTU Modes Item ASCII Mode RTU Mode Number of data bits 7 bits (ASCII) 8 bits (binary) Message start mark : (colon) None Message end mark CR+LF (*2) None Message length * 2N+1 N Data time intervals 1 second or less Between frames: 3.
5.1.1 5-3 <5. Modbus/RTU and ASCII Communication Protocols> Configuration of Message Messages sent from the higher-level device to the PR300 consist of the following elements.
5.1.2 <5. Modbus/RTU and ASCII Communication Protocols> 5-4 Specifying D Registers Specification of D registers using commercially available SCADA or other software and specification of D registers for messages used in a customer-created communication program are different. Take note of this. For a customer-created communication program, specify a value in hexadecimal that is obtained by subtracting 40001 from a reference number.
<5. Modbus/RTU and ASCII Communication Protocols> 5-5 ■ RTU Mode In the RTU mode, errors are checked by means of a CRC-16 cyclic redundancy check. The CRC-16 value is the 16-bit remainder when the value obtained by concatenating the 8 bits of all blocks (from the station number to the last data item) of a message, excluding the start bit, stop bit and parity bit, is divided by a predetermined 17-bit binary number.
<5. Modbus/RTU and ASCII Communication Protocols> Table 5.
5.1.4 <5. Modbus/RTU and ASCII Communication Protocols> 5-7 Configuration of Response The PR300 receives a command message from the higher-level device. If the received command message is found to be normal and directed at the station number of the PR300 itself, the PR300 concludes the content of the message to be normal. Thus, the PR300 enters the phase of executing message processing, deciphers the content of the command message, and processes with the message.
5-8 <5.
5.1.5 <5. Modbus/RTU and ASCII Communication Protocols> 5-9 Specifying Broadcast The corresponding multiple PR300s perform the function to receive and process a command in which this station number is specified. (1) Specify “00” for the station number in the command to execute it. (2) This command works independently of station numbers of slave stations. (3) This command is applicable for writing only.
5.2 <5. Modbus/RTU and ASCII Communication Protocols> 5-10 Message and Response Function codes are command words used by the higher-level device to obtain the D registers information of PR300. Table 5.3 Function Codes Code Function Description 03 Reads data from multiple D registers. Capable of reading data from a maximum of 64 successive D registers between D0001 and D0400. 06 Writes data into D register. Capable of writing data into one D register between D0001 and D0400.
03 5-11 <5. Modbus/RTU and ASCII Communication Protocols> Reads data from multiple D registers ● Function This function code reads the contents of successive D registers by the specified number starting with a specified D registers number. • The maximum number of D registers to be read at a time is 64. • For the format of responses in the event of failure, see subsection 5.1.4.
06 5-12 <5. Modbus/RTU and ASCII Communication Protocols> Writes data into D register ● Function This function code writes data into a specified D registers number. • The maximum number of D registers to be written into at a time is 1. • For the format of response in the event of failure, see subsection 5.1.4. • Broadcast addressing is possible (by setting “00” to the station number).
08 5-13 <5. Modbus/RTU and ASCII Communication Protocols> Performs loop back test ● Function This function code is used to check connection for communication. • For the format of response in the event of failure, see subsection 5.1.4. • The “00” shown below (marked with an asterisk *) are fixed. • Any value can be selected for transmit data.
16 5-14 <5. Modbus/RTU and ASCII Communication Protocols> Writes data into multiple D registers ● Function This function code writes data into successive D registers by the number starting with a specified D registers number. • The maximum number of D registers to be written into at a time is 32. • For the format of response in the event of failure, see subsection 5.1.4. • Broadcast addressing is possible (by setting “00” to the station number).
<5. Modbus/RTU and ASCII Communication Protocols> 5-15 ● Example (ASCII mode) Write 10 into a series of four D registers starting with the D0201 (VT ratio and CT ratio) at station number 11.
< 6. Modbus/TCP Communication Protocol> 6. Modbus/TCP Communication Protocol 6.1 Overview 6-1 Modbus/TCP is one of the protocol used to communicate with devices such as PCs or PLCs (sequencers) using the TCP/IP protocol via Ethernet and other networks. This communication protocol is used to perform read/write operations with the D registers in the PR300 and exchange data with connected devices. The PR300 can be connected to IEEE802.3-compliant networks (10BASE-T/ 100BASE-TX).
< 6. Modbus/TCP Communication Protocol> (Example) Higher-level device IP address [192.168.1.1] (arbitrary) Maximum distance between hub and module: 100 m Maximum number of hubs connectable in cascade configuration: 4 levels for 10BASE-T 2 levels for 100BASE-TX HUB LAN connection PR300 as Ethernet-serial gateway function Station number 01 (fixed) IP address [192.168.1.2] (arbitrary) Station number 01 (fixed) IP address [192.168.1.3] (arbitrary) Station number 01 (fixed) IP address [192.
6.2 < 6. Modbus/TCP Communication Protocol> 6-3 TCP/IP Communication Modbus/TCP communicates with other devices, following the procedure below, through the TCP/IP socket interface. PC Ethernet PR300 with Ethernet communication function Initial Setup Initial Setup socket() socket() bind() listen() Open connection connect() accept() Command send() recv() Response recv() send() Terminate connection close() close() Figure 6.
6.3 < 6. Modbus/TCP Communication Protocol> 6-4 Network Frame Structure The Modbus/TCP frame structure is as follows: MODBUS TCP/IP ADU MBAP Header Function code Data PDU MBAP Header (Modbus Application Protocol Header) : Header used to identify the Modbus/TCP protocol PDU: simple Protocol Data Unit 6.3.1 MBAP Header Structure The MBAP Header (Modbus Application Protocol Header) consists of the following seven bytes.
< 6. Modbus/TCP Communication Protocol> 6.4 Communication with Higher-level Devices 6.4.1 List of Function Codes 6-5 The codes in the following list are command words higher-level devices use to acquire information from the internal registers (D registers) of the PR300. Code Function Description 03 Reads data from multiple D registers. Capable of reading data from a maximum of 64 successive D registers between D0001 and D0400. 06 Writes data into D register.
6.4.3 03 6-6 < 6. Modbus/TCP Communication Protocol> Request and Response Reads data from multiple D registers ● Function This function code reads the contents of successive D registers by the specified number starting with a specified D registers number. • The maximum number of D registers to be read at a time is 64. • For the format of responses in the event of failure, see subsection 6.4.4.
06 6-7 < 6. Modbus/TCP Communication Protocol> Writes data into D register ● Function This function code writes data into a specified D register number. • The maximum number of D registers to be written into at a time is 1. • For the format of response in the event of failure, see subsection 6.4.4.
08 6-8 < 6. Modbus/TCP Communication Protocol> Performs loop back test ● Function This function code is used to check connection for communication. • For the format of response in the event of failure, see subsection 6.4.4. • The “0000” shown below (marked with an asterisk *) are fixed. • Any value can be selected for transmit data.
16 6-9 < 6. Modbus/TCP Communication Protocol> Writes data into multiple D registers ● Function This function code writes data into successive D registers by the number starting with a specified D registers number. • The maximum number of D registers to be written into at a time is 32. • For the format of response in the event of failure, see subsection 6.4.4. • Broadcast addressing is possible (by setting “00” to the station number).
< 6. Modbus/TCP Communication Protocol> ● Example Set both the VT ratio and CT ratio to 1.
6.4.4 < 6. Modbus/TCP Communication Protocol> 6-11 Response Error Codes ● When a response is returned If an inconsistency is found in a request’s PDU, the PR300 ignores the request and returns the following response.
< 6. Modbus/TCP Communication Protocol> 6.5 Sample Program 6.5.1 Example of BASIC Program for Send and Receive 6-12 This section shows an example of a command sending and response receiving program created with Visual-Basic*2 for PC/AT*1 (or compatible machines). *1 PC/AT is the product of IBM Ltd. *2 Visual-BASIC is a registered trademark of Microsoft Corporation in the United States. (Example) Higher-level device IP address [192.168.1.
< 6. Modbus/TCP Communication Protocol> 6-13 Example of the Program Created Using Visual-BASIC Version 6.0 In this sample program, command sending and response receiving are carried out by the method for connection and sending and SendData method of Winsock control. ● Preparation Since this sample program uses Winsock control, it is necessary to assign the Microsoft Winsock Control component. Refer to the user’s manual of Visual-Basic for how to assign the component.
< 6.
< 6.
7-1 <7. Functions and Usage of D Registers> 7. Functions and Usage of D Registers 7.1 Overview of D Registers This section describes the functions and usage of D registers. The D registers store the input values, statuses, and others that are handled by the PR300. By connecting the PR300 to higher-level device capable of PC link communication, Modbus communication, or Ethernet communication, you can readily use these internal data items by reading from or writing to the D registers. 7.
7.4 7-2 <7. Functions and Usage of D Registers> D Register Map ● Process Data (D0001 to D0146) Ref No. H No. D0001 D-Reg No.
D-Reg No. Ref No. H No. 40109 006C D0110 40110 D0111 40111 D0112 40112 D0113 40113 D0109 7-3 <7.
7-4 <7. Functions and Usage of D Registers> ● Parameter/Control Data (D0201 to D0400) D-Reg No. Ref No. H No.
7-5 <7. Functions and Usage of D Registers> D-Reg No. Ref No. H No.
<7. Functions and Usage of D Registers> 7-6 D0099 and D0100 are designed to represent two or more events, such as errors and status, using combinations of bits within the register. If any of the events shown in the following tables occur, the corresponding bit is set to 1. The bit remains 0 if the event does not occur. Note that bits with blank fields in the tables are not in use.
<8. PR201 Original Communication Protocol> 8-1 8. PR201 Original Communication Protocol 8.1 Overview This function enables various measured values to be read into a personal computer through the use of a command/response method. There are two ways for reading the values. One is used to read values individually and another to read them in batch mode (where only measurement items in the specified mode can be read). 8.
8.3 <8. PR201 Original Communication Protocol> 8-2 Command/Response Format Command components: 1 byte STX 2 bytes 1 byte Command Parameter 2 bytes Variablelength 2 bytes 1 byte 1 byte Station number Data Checksum ETX CR Checksum range STX: Start of Text (hexadecimal: 02) Command: 2-byte ASCII code (DG or DP) Parameter: 1-byte ASCII code (0 to Z) Station number: 2-byte ASCII code (01 to 63) Data: No data is found at data read-out time.
8.4 8-3 <8. PR201 Original Communication Protocol> List of Commands Parameters common for preceding styles (PR201S1.0, UZ005S2.0) Parameter Response data Meaning Format Range 0 Read measured values in batch. Data of parameters 1 to 5 and 6 (power factor measurement) 1 Read electric energy ⵧⵧⵧⵧⵧ 2 Read optional electric (Previous value) ⵧⵧⵧⵧⵧ energy *1 (Current value) ⵧⵧⵧⵧⵧ 3 Instantaneous power ⵧ.
8-4 <8. PR201 Original Communication Protocol> Command: DP Parameter *2 Meaning 0 Read setting value 1 ––– 2 ––– 3 ––– 4 Set VT ratio 5 Set CT ratio 6 ––– 7 ––– 8 ––– 9 ––– A Remote reset B Integrated low-cut power C D Model Response data format No data Response data range Response data size See *2 for response 16 byte Not available in PR300 ⵧⵧⵧⵧⵧ 00001 to 06000 5 bytes Not available in PR300 ⵧⵧⵧⵧⵧ 00.05 to 32000 5 bytes Not available in PR300 ⵧⵧ.ⵧ 00.
8.5 8-5 <8. PR201 Original Communication Protocol> Command Details ■ Command: DG ● Parameter: 0 (Reads measured values in batch) • Function This command reads the active energy, optional electric energy (previous and current values), active power, voltage-1, current-1 and the power factor. • Command/response Number of bytes 1 Command STX element 2 1 2 DG 0 Station number (ADR) 2 1 1 Checksum ETX CR There is no command data for data reading.
<8. PR201 Original Communication Protocol> 8-6 ● Parameter: 1 (Reads electric energy) • Function Reads the active energy. • Command/response Number of bytes 1 Command STX element 2 1 2 DG 1 Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading. Number of bytes 1 Response STX element 2 1 2 5 2 DG 1 Station number (ADR) ⵧⵧⵧⵧⵧ 1 Checksum ETX 1 CR Response data is returned as a 5-byte ASCII character string (00000 to 99999).
8-7 <8. PR201 Original Communication Protocol> ● Parameter: 2 (Reads optional electric energy) • Function Reads the previous value and current value of optional electric energy. • Command/response Number of bytes 1 Command STX element 2 1 2 DG 2 Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading.
<8. PR201 Original Communication Protocol> 8-8 • Example Reads the active power of PR300 with station number 01. 䊐䊐 indicates the checksum value. [Command] [STX]DG301䊐䊐[ETX][CR] Returns a response of active power 1000 W (+1.000E+3 W) for the above command. [Response] [STX]DG301+1.
<8. PR201 Original Communication Protocol> 8-9 ● Parameter: 5 (Instantaneous current-1), parameter: K (Instantaneous current2), Parameter: L (Instantaneous current-3) • Function Reads current-1 by parameter: 5, current-2 by parameter: K and current-3 by parameter: L. • Command/response Number of bytes 1 Command STX element 2 1 2 DG 5 (K) (L) Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading.
<8. PR201 Original Communication Protocol> 8-10 • Example Reads a power factor of PR300 with station number 01. 䊐䊐 indicates the checksum value. [Command] [STX]DG601䊐䊐[ETX][CR] Returns a response of power factor G0.8 for the above command. [Response] [STX]DG601G0.800䊐䊐[ETX][CR] ● Parameter: 7 (Starts optional integration) • Function Starts optional integration.
<8. PR201 Original Communication Protocol> 8-11 ● Parameter: 8 (Stops optional integration) • Function Stops optional integration. • Command/response Number of bytes 1 Command STX element 2 1 2 DG 8 Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading. Number of bytes 1 Response STX element 2 1 2 0 DG 8 Station number (ADR) No data 2 1 Checksum ETX 1 CR There is no response data.
8-12 <8. PR201 Original Communication Protocol> • Example Initializes the maximum and minimum values of PR300 with station number 01. 䊐䊐 indicates the checksum value. [Command] [STX]DG901䊐䊐[ETX][CR] Returns the following response for the above command.
<8. PR201 Original Communication Protocol> 8-13 • Example Reads in batch the measured values and maximum/minimum value of PR300 with station number 01. [Command] [STX]DGA01䊐䊐[ETX][CR] Returns the following response for the above command. [Response] [STX]DGA01100001000010000+1.000E+31.000E+31.000E+3G0.8001.000E+31.000E+21.
<8. PR201 Original Communication Protocol> 8-14 • Example Reads the maximum voltage-1 of PR300 with station number 01. 䊐䊐 indicates the checksum value. [Command] [STX]DGB01䊐䊐[ETX][CR] Returns a response of the maximum voltage-1: 1000 V (1.000E+3 V) for the above command. [Response] [STX]DGB011.000E+3䊐䊐[ETX][CR] ● Parameter: D (Reads maximum current-1), Parameter: E (Reads maximum current-2.
8-15 <8. PR201 Original Communication Protocol> ● Parameter: F (Reads measured values in batch) • Function Reads the active energy, optional electric energy (previous and current values), active power, voltage-1, voltage-2, voltage-3, current-1, current-2, current-3 and power factor. • Command/response Number of bytes 1 Command STX element 2 1 2 DG F Station number (ADR) 2 1 1 Checksum ETX CR There is no command data for data reading.
8-16 <8. PR201 Original Communication Protocol> ● Parameter: G (Reads electric energy) • Function Reads the active energy. • Command/response Number of bytes 1 Command STX element 2 1 2 DG G Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading. Number of bytes 1 Response STX element 2 1 2 8 2 DG G Station number (ADR) ⵧⵧⵧⵧⵧE+䊊 1 1 Checksum ETX CR Response data is returned as an 8-byte ASCII character string (00000E+0 to 99999E+6).
8-17 <8. PR201 Original Communication Protocol> ● Parameter: M (Reads measured values and maximum/minimum values in batch) • Function Reads the active energy, optional electric energy (previous and current values), active power, voltage-1, voltage-2, voltage-3, current-1, current-2, current-3, power factor, maximum voltage-1, minimum voltage-1, maximum current-1, maximum voltage-2, maximum voltage-3, minimum voltage-2, minimum voltage-3, maximum current-2 and maximum current-3.
8-18 <8. PR201 Original Communication Protocol> ● Example Reads the measured value and maximum/minimum values of PR300 with station number 01 in batch. 䊐䊐 indicates the checksum value. [Command] [STX]DGM01䊐䊐[ETX][CR] Returns the following response for the above command. [Response] [STX]DGM0110000E+31000010000+1.000E+31.000E+31.000E+31.000E+3 (1) (2) (3) (4) (5) (6) (7) 1.000E+31.000E+31.000E+3G0.8001.000E+31.000E+21.000E+3 (8) (9) (10) (11) (12) (13) (14) 1.000E+31.000E+31.000E+21.000E+21.
<8. PR201 Original Communication Protocol> 8-19 Note 1: Information on model and suffix codes PR201-夽夹011-20 夽: Returns the current phase and wire system: 1: Single-phase two-wire 2: Single-phase three-wire 3. Three-phase three-wire 4. Three-phase four-wire 5. Three-phase four-wire (2.5e) 夹: Returns the current rated input: 1: 150V/1A 2: 150V/5A 3: 300V/1A 4: 300V/5A 5: 600V/1A 6: 600V/5A 011: Returns a suffix code. 0: Produces neither analog output nor pulse output.
<8. PR201 Original Communication Protocol> 8-20 ● Parameter: Z (Error response) • Function Returns an error response. • Command/response Number of bytes 1 Command STX element 2 1 2 DG Z Station number (ADR) 2 1 Checksum ETX 1 CR There is no command data for data reading. Number of bytes 1 Response STX element 2 1 2 2 DG Z Station number (ADR) ⵧⵧ 2 1 Checksum ETX 1 CR Response data is returned in a 2-byte ASCII character string.
<8. PR201 Original Communication Protocol> 8-21 ■ Command: DP ● Parameter: 0 (Reads setting value) • Function Reads the VT ratio, CT ratio and integrated low-cut power. The read low-cut power is always 0.
<8. PR201 Original Communication Protocol> 8-22 ● Parameter: A (Remote reset) • Function Performs remote reset. If remote reset is performed, the maximum value, minimum value, and instantaneous value of voltage and current are reset. If remote reset is performed at the start of optional integration, optional integration itself stops. Even if remote reset is performed, the data and parameter setting values of active energy remains unchanged.
<8. PR201 Original Communication Protocol> 8-23 ● Parameter: G (Integration reset) • Function Resets the active energy. • Command/response Number of bytes 1 Command STX element Number of bytes 1 Response STX element 2 1 2 DP G Station number (ADR) 2 1 2 DP G Station number (ADR) 2 1 Checksum ETX 2 1 Checksum ETX 1 CR 1 CR There is no response data. • Example Resets the active energy of PR300 with station number 01. 䊐䊐 indicates the checksum value.
App.-1 Appendix Table of ASCII Codes (Alphanumeric Codes) In order to implement PC link communication, create a transmission/receiving program by referring to the Table of ASCII Codes below. Hex. Dec. Symbol Hex. Dec. Symbol Hex. Dec. Symbol Hex. Dec.
i Revision Information ● Title : Model PR300 Power and Energy Meter Communication Interface User’s Manual (RS-485 and Ethernet Communications) ● Manual No. : IM77C01E01-10E Apr. 2006/1st Edition Newly published Aug. 2006/2nd Edition The PR201 original communication protocol is added. Feb. 2007/3rd Edition The note of the RS-232C/RS-485 converter is added.
YOKOGAWA ELECTRIC CORPORATION Headquarters 2-9-32, Nakacho, Musashino-shi, Tokyo, 180-8750 JAPAN Branch Sales Offices Nagoya, Osaka, Hiroshima, Fukuoka, Sapporo, Sendai, Ichihara, Toyota, Kanazawa, Okayama, and Kitakyusyu. YOKOGAWA CORPORATION OF AMERICA 2 Dart Road, Newnan, Georgia 30265-1094, U.S.A. Phone : 1-800-888-6400 Fax : 1-770-254-0928 YOKOGAWA EUROPE B. V.