Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Altivar 12
Variable speed drives for asynchronous motors Modbus Communication Manual
04/2009
BBV28590
www.schneider-electric.com
Contents
Important Information __________________________________________________________________________________________ 4 Before you begin______________________________________________________________________________________________ 5 Documentation structure________________________________________________________________________________________ 6 Presentation _________________________________________________________________________________________________ 7 Connection to RS485 bus_______________________________________________________________________________________ 8 Configuration of the Modbus serial port ____________________________________________________________________________ 9 IO Scanner configuration parameters_____________________________________________________________________________ 10 Modbus Functions ___________________________________________________________________________________________ 12 ATV12 state machine _________________________________________________________________________________________ 17 Application example __________________________________________________________________________________________ 21 Connection to RS485 bus______________________________________________________________________________________ 24
BBV28590 04/2009
Important Information
NOTICE
Read these instructions carefully, and look at the equipment to become familiar with the device before trying to install, operate, or maintain it. The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure.
The addition of this symbol to a Danger or Warning safety label indicates that an electrical hazard exists, which will result in personal injury if the instructions are not followed.
This is the safety alert symbol. It is used to alert you to potential personal injury hazards. Obey all safety messages that follow this symbol to avoid possible injury or death.
DANGER
DANGER indicates an imminently hazardous situation, which, if not avoided, will result in death or serious injury.
WARNING
WARNING indicates a potentially hazardous situation, which, if not avoided, can result in death or serious injury.
CAUTION
CAUTION indicates a potentially hazardous situation, which, if not avoided, can result in minor or moderate injury.
CAUTION
CAUTION, used without the safety alert symbol, indicates a potentially hazardous situation which, if not avoided, can result in property damage.
PLEASE NOTE The word "drive" as used in this manual refers to the controller portion of the adjustable speed drive as defined by NEC. Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material. 2009 Schneider Electric. All Rights Reserved
BBV28590 04/2009
Read and understand these instructions before performing any procedure with this drive.
DANGER
HAZARD OF ELECTRIC SHOCK, EXPLOSION, OR ARC FLASH
Read and understand this manual before installing or operating the Altivar 12 drive. Installation, adjustment, repair, and maintenance must be performed by qualified personnel. The user is responsible for compliance with all international and national electrical code requirements with respect to grounding of all equipment. Many parts of this drive, including the printed circuit boards, operate at the line voltage. DO NOT TOUCH. Use only electrically insulated tools. DO NOT touch unshielded components or terminal strip screw connections with voltage present. DO NOT short across terminals PA/+ and PC/ or across the DC bus capacitors. Before servicing the drive: - Disconnect all power, including external control power that may be present. - Place a DO NOT TURN ON label on all power disconnects. - Lock all power disconnects in the open position. - WAIT 15 MINUTES to allow the DC bus capacitors to discharge. Then follow the Bus Voltage Measurement Procedure (see User manual) to verify that the DC voltage is less than 42 V. The drive LEDs are not indicators of the absence of DC bus voltage. Install and close all covers before applying power or starting and stopping the drive. Failure to follow these instructions will result in death or serious injury.
DANGER
UNINTENDED EQUIPMENT OPERATION
Read and understand this manual before installing or operating the Altivar 12 drive. Any changes made to the parameter settings must be performed by qualified personnel. Failure to follow these instructions will result in death or serious injury.
WARNING
DAMAGED DRIVE EQUIPMENT
Do not operate or install any drive or drive accessory that appears damaged. Failure to follow these instructions can result in death, serious injury, or equipment damage.
WARNING
LOSS OF CONTROL
The designer of any control scheme must - consider the potential failure modes of control paths and, for certain critical control functions, - provide a means to achieve a safe state during and after a path failure. Examples of critical control functions are emergency stop and overtravel stop. Separate or redundant control paths must be provided for critical control functions. System control paths may include communication links. Consideration must be given to the implications of unanticipated transmission delays or failures of the link.a Failure to follow these instructions can result in death, serious injury, or equipment damage. a. For additional information, refer to NEMA ICS 1.1 (latest edition), Safety Guidelines for the Application, Installation, and Maintenance of Solid State Control and to NEMA ICS 7.1 (latest edition), Safety Standards for Construction and Guide for Selection, Installation and Operation of Adjustable-Speed Drive Systems.
BBV28590 04/2009
Documentation structure
The following Altivar 312 technical documents are available on the Schneider Electric website (www.schneider-electric.com) as well as on DVD-ROM (reference VW3A8200).
User manual
This manual describes how to install, commission, operate and program the drive.
Simplified manual
This manual is a simplified version of the User manual. This manual is delivered with the drive.
ATV12P manual
This manual describes the features related to products mounted on baseplate.
DANGER
UNINTENDED EQUIPMENT OPERATION
Read and understand this manual before installing or operating the Altivar 12 drive. Any changes made to the parameter settings must be performed by qualified personnel. The excel file does not describe the behaviour of the parameters. Before any modification, refer to the ATV12 User Manual. Failure to follow these instructions will result in death or serious injury.
BBV28590 04/2009
Presentation
The Modbus socket on the Altivar 12 can be used for the following functions: Configuration Settings Control Monitoring
The ATV12 drive supports: The 2-wire RS485 physical layer The RTU transmission mode
BBV28590 04/2009
8........................1
Pin 1 2 3 4 5 6 7 8 Signal D1 (1) D0 (1) VP (2) Common (1)
(1) Modbus signals (2) Supply for RS232 / RS485 converter or a remote terminal
BBV28590 04/2009
19,2 kbps
16#1773 = 06003
8E1
16#1774 = 06004
10,0 s
16#1775 = 06005
The behaviour of the ATV12 when a time-out occurs is defined by the SLL parameter, this parameter can be found in the menu FLt(see User Manual).
WARNING
LOSS OF CONTROL
If Modbus fault management (SLL) = fault ignore (n0), communication control will be inhibited. For safety reasons, inhibition of communication fault should only be used for adjustment or special applications purpose. Failure to follow these instructions can result in death, serious injury, or equipment damage.
BBV28590 04/2009
10
BBV28590 04/2009
Communication scanner
menu submenu COMCOM-, OCS-
The required telegram to perform the exchange is the Modbus function 23, Obviously a sequence of requests based on Modbus functions 03 and 16 is also possible. (See also the chapters Modbus Functions and Altivar 12 and M340).
BBV28590 04/2009
11
Modbus Functions
Modbus Protocol
The transmission mode used is RTU mode. The frame contains no message header byte, nor end of message bytes. It is defined as follows: Slave address
Request code
Data
CRC16
The data is transmitted in binary code. CRC16: cyclical redundancy check. The end of the frame is detected on a silence greater than or equal to 3 characters.
Principle
The Modbus protocol is a master-slave protocol. Master Only one device can transmit on the line at any time. The master manages the exchanges and only it can take the initiative. It interrogates each of the slaves in succession. No slave can send a message unless it is invited to do so. The master repeats the question when there is an incorrect exchange, and declares the interrogated slave absent if no response is received within a given time period. If a slave does not understand a message, it sends an exception response to the master. The master may or may not repeat the request. Slave k
For slave-to-slave communication, the application software must therefore be designed to interrogate a slave and send back data received to the other slave. Two types of dialogue are possible between master and slaves: the master sends a request to a slave and waits for its response the master sends a request to all slaves without waiting for a response (broadcasting principle)
Addresses
The drive Modbus address can be configured from 1 to 247. Address 0 coded in a request sent by the master is reserved for broadcasting. ATV12 drives take account of the request, but do not respond to it.
12
BBV28590 04/2009
Modbus Functions
Response
Function code Byte count Register value *N: Quantity of Registers 1 Byte 1 Byte N* x 2 Bytes 0x03 2 x N*
Error
Error code Exception code 1 Byte 1 Byte 0x83 01 or 02 or 03 or 04 (see details on page 16)
Example
Note: Hi = high order byte, Lo = low order byte. This function can be used to read all ATV12 words, both input words and output words. Request Slave no. 1 byte Response Slave no. 1 byte
03
CRC16 Hi 2 bytes
1 byte
03
-------
CRC16 Hi 2 bytes
1 byte
Example: read 4 words W3102 to W3105 (16#0C1E to 16#0C21) in slave 2, using function 3, where: SFr = Switching frequency = 4 kHz (W3102 = 16#0028) tFr = Maximum output frequency = 60 Hz (W3103 = 16#0258) HSP = High speed = 50 Hz (W3104 = 16#01F4) LSP = Low speed = 0 Hz (W3105 = 16#0000) Request Response 02 02 03 03 Value of: Parameters: 08 0C1E 0028 W3102 SFr 0004 0258 W3103 tFr 276C 01F4 W3104 HSP 0000 W3105 LSP 52B0
BBV28590 04/2009
13
Modbus Functions
Write one output word
Request
Function code Register Address Register value 1 Byte 2 Bytes 2 Bytes 0x06 0x0000 to 0xFFFF 0x0000 to 0xFFFF
Response
Function code Register Address Register value 1 Byte 2 Bytes 2 Bytes 0x06 0x0000 to 0xFFFF 0x0000 to 0xFFFF
Error
Error code Exception code 1 Byte 1 Byte 0x86 01 or 02 or 03 or 04 (see details on page 16)
Example
Request and response (the frame format is identical) Slave no. 1 byte 06 Hi 1 byte 2 bytes Word number Lo Hi 2 bytes Value of word Lo Lo 2 bytes CRC16 Hi
Example: write value 16#000D in word W9001 (16#2329) in slave 2 (ACC = 13 s). Request and response 02 06 2329 000D 9270
Example
Slave n Function Code 1 byte Read starting Read starting Address HI Address LOW 1 byte 1 byte Qty Write starting Write starting Address HI Address LOW 1 byte Writing Value 1.. 2... 3...n ... 1 byte 1 byte Qty
2 byte
2 byte
Value 1 Lo 1 byte
Value 1 HI 1 byte
CRC16 2 byte
14
BBV28590 04/2009
Modbus Functions
Read Device Identification
ID 0x00 0x01 0x02 Name / Description VendorName ProductCode MajorMinorRevision Type ASCII String ASCII String ASCII String
1 byte
-------
-------
-------
------Lo 1 byte
CRC16 Hi 1 byte
The total response size equals 49 bytes The three objects contained in the response correspond to the following objects: Object no. 1: Object no. 2: Object no. 3: Manufacturer name (always Schneider Electric, ie. 18 bytes). Device reference (ASCII string; for example: ATV12HU75M3, ie. 11 bytes). Device version, in MMmm format where MM represents the determinant and mm the subdeterminant (4-bytes ASCII string; for example: 0201 for version 2.1).
Note: The response to function 43 may be negative; in this case, the response located at the top of the next page is sent by the Altivar 12 rather than the response described above.
BBV28590 04/2009 15
Modbus Functions
Error management
Exception responses
An exception response is returned by a slave when it is unable to perform the request which is addressed to it. Format of an exception response: Slave no. 1 byte Response code 1 byte Error code 1 byte CRC16 Lo 2 bytes Hi
Response code: request function code + 16#80. Error code: 1 = The function requested is not recognized by the slave 2 = The bit or word addresses indicated in the request do not exist in the slave 3 = The bit or word values indicated in the request are not permissible in the slave 4 = The slave has started to execute the request but cannot continue to process it completely
CRC16 calculation
The CRC16 is calculated on all the message bytes by applying the following method: Initialize the CRC (16-bit register) to 16#FFFF. Enter the first to the last byte of the message: CRC Enter XOR 8 times Move the CRC one bit to the right If the output bit = 1, enter CRC XOR 16#A001> CRC End enter End enter The CRC obtained will be transmitted with the low order bytes sent first, followed by the high order ones (unlike the other data contained in Modbus frames). XOR = exclusive OR. <byte> > CRC
16
BBV28590 04/2009
Fault
From all states
Fault
Fault
Shutdown CMD=16#0006
Ready to switch on
Disable voltage CMD=16#0000 or Quick stop CMD=16#0002 or STOP key or freewheel stop at the terminals or modification of a configuration parameter
After quick stop order, the drive stops according to the fast stop ramp and then changes to state "2 Switch on disabled".
Switch on CMD=16#0007
Shutdown CMD=16#0006
Shutdown CMD=16#0006
Switched on
Switch on CMD=16#xxxF
Operation enabled
Examples:
ETA=16#0637: Stop or forward, speed reached ETA=16#8637: Stop or reverse, speed reached ETA=16#0237: Forward, accelerating or decelerating ETA=16#8237: Reverse, accelerating or decelerating
State
Switched on
BBV28590 04/2009
17
Malfunction (Fault):
The drive is locked.
Summary
State 1 - Not ready to switch on 2 - Switch on disabled 3 - Ready to switch on 4 - Switched on 5 - Operation enabled 6 - Quick stop active 7 - Fault reaction active 8 - Fault Power supplied to motor No No No No Yes, except at zero reference or "halt" Yes, during fast stop Depends on fault managment configuration No Modification of configuration parameters Yes Yes Yes Yes, return to "2 - Switch on disabled" state No No Yes
18
BBV28590 04/2009
bit 15 Reserved
bit 13 Reserved
bit 12 Reserved
Command
Transition address
Final state
bit 0 Switch on 0 1 1 1 x x
Example value
Shutdown Switch on Enable operation Disable operation Disable voltage Quick stop
2, 6, 8 3 4 5 7, 9, 10, 12 11 7, 10
3 - Ready to switch on 4 - Switched on 5 - Operation enabled 4 - Switched on 2 - Switch on disabled 6 - Quick stop active 2 - Switch on disabled 2 - Switch on disabled
x x x x x x
Fault reset
15
01
16#0080
BBV28590 04/2009
19
Status
bit 3 Fault
bit 1 Switched on 0 0 0 1 1 1 1 0
1 -Not ready to switch on 2 - Switch on disabled 3 - Ready to switch on 4 - Switched on 5 - Operation enabled 6 - Quick stop active 7 - Fault reaction active 8 - Fault
0 1 0 0 0 0 0 0
x x 1 1 1 0 x x
0 0 0 0 0 0 1 1
x: In this state, the value of the bit can be 0 or 1. (1) This mask can be used by the PLC program to test the chart state. (2) Fault following state "6 - Quick stop active".
20
BBV28590 04/2009
Application example
Connecting an ATV12 to a M340 PLC
Here is an example of an application that shows how to control an ATV12 from a M340 PLC equipped with a Modbus master serial port. The program provides a control of the drive from an operator screen designed under Unity. The example illustrates also the previous chapter
BBV28590 04/2009
21
Application example
Initialization
The communication is based on the READ_VAR , WRITE_VAR functions. During the first execution of the MAST task you can initialize the data structures used by these two functions. Devicepath describes the path to the device including its slave address. ReadVarMgt and WriteVarMgt are arrays used respectively by READ_VAR and WRITE_VAR. Only the 3rd element of these arrays is modifiable by the user: To define the time out duration of the requests
(* data initialization *) (* Communication path to Modbus slave device at @ 3 (* The device path can be modified later by the app. (* MSB of DevicePath[3] contains the device address DevicePath := ADDM ('0.0.0.3'); (* Time out duration *) ReadVarMGT[2]:=50; WriteVarMGT[2]:=50; *) *) *)
22
BBV28590 04/2009
Application example
Cyclical exchanges
In the example below the application manages 2 requests: "A read request of 4 words starting at Modbus address 12741 (NMA1) - Modbus function #3 "A write request of 4 words starting at Modbus address 12761 (NCA1) - Modbus function #16 Requests are executed only each N x FAST task to avoid too much activity on the serial line. The device can be modified (polling several devices) by writing in DevicePath[3].
Cyclical communication
(* Modbus Requests are sent only each: ( ModbusRequestPeriod X FAST period X n) *) if ModbusRequestPeriod >25 then (* Read request to ATV12 : Modbus function 3 *) IF not ReadVarBusy then READ_VAR(DevicePath, '%MW' , 12741, 4, ReadVarMGT, %MW124:4); (*Devicepath is initialized during Init_Sequence *) END_IF; (* Write request to ATV12 : Modbus function 16 *) IF not WriteVarBusy then WRITE_VAR(DevicePath, '%MW' , 12761, 4, %MW120:4, WriteVarMGT); END_IF; ModbusRequestPeriod:=0; END_IF;
The key data are highlighted: address and lengh in the device source and destination of the data in the PLC. The time out can be managed by the application in a separate way by testing the activity of the 2 bits: ReadVarBusy and WriteVarBusy Overview of the communication tables:
BBV28590 04/2009
23
5V 650
650 0V
Slave 1
Slave n
Type of trunk cable Maximum length of bus Maximum number of stations (without repeater) Maximum length of tap links Bus polarisation
Shielded cable with 1 twisted pair and at least a 3rd conductor 1000 m at 19200 bps with the Schneider Electric TSX CSAppp cable 32 stations, ie. 31 slaves 20 m for one tap link 40 m divided by the number of tap links on a multiple junction box One 450 to 650 pulldown resistor at 5 V (650 recommended) One 450 to 650 pulldown resistor at the Common (650 recommended) This polarisation is recommended for the master. One 120 0.25 W resistor in series with a 1nF 10 V capacitor Yes (Common), connected to the protective ground at one or more points on the bus
24
BBV28590 04/2009