Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 14 of 19

GS2 Series Drives User Manual, pages 131 to 140

Pages 131 to 140 of 190

The original document is the PDF (5.6 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the AutomationDirect GS2

Page 131

Chapter 5: GS2 Modbus Communications

DirectLOGIC Modbus Ladder Programming (cont.) Rungs 17 through 26 show an example of a method of inputting command values into the PLC. This rung loads speed 1 into V3000. LD: loads the constant value of 300 in BCD format; BIN: converts from BCD to binary (HEX) format; OUT: stores value in V3000 to instruct the drive to run at 30.0 Hz. Speed Bit 1 30.0 Hz X3

Speed Bit 2 60.0 Hz X4

17

LD K300 BIN

OUT V3000 This rung loads speed 2 into V3000. LD: loads the constant value of 600 in BCD format; BIN: converts from BCD to binary (HEX) format; OUT: stores value in V3000 to instruct the drive to run at 60.0 Hz. Speed Bit 1 30.0 Hz X3 18

Speed Bit 2 60.0 Hz X4

LD K600 BIN

OUT V3000 This rung loads a value of 1 into V3001 for the drive Run Command Run / Stop X5 19

LD K1 OUT V3001

This rung loads a value of 0 into V3001 for the drive Stop Command Run / Stop X5 20

LD K0 OUT V3001

(Continued next page)

1st Ed. Rev. C

12/2006

GS2 Series AC Drive User Manual

5–27

Page 132

Chapter 5: GS2 Modbus Communications

DirectLOGIC Modbus Ladder Programming (cont.) This rung loads a value of 1 into V3002 for the drive Reverse Command Reverse / Forward X6 21

LD K1 OUT V3002

This rung loads a value of 0 into V3002 for the drive Forward Command Reverse / Forward X6 22

LD K0 OUT V3002

This rung loads a value of 1 into V3003 for the drive External Fault Command. External Fault X7 23

LD K1 OUT V3003

This rung loads a value of 0 into V3003 to remove the External Fault Command. External Fault X7 24

LD K0 OUT V3003

This rung loads a value of 1 into V3004 for the drive External Fault Reset Command External Fault Reset X8 25

LD K1 OUT V3004

This rung loads a value of 0 into V3004 to remove the External Fault Reset Command External Fault Reset X8 26

LD K0 OUT V3004

27

5–28

GS2 Series AC Drive User Manual

( END )

Page 133

Chapter 5: GS2 Modbus Communications

DirectLOGIC Modbus Ladder Programming (cont.) Separate Run Command Write Instruction Why do we write the Run Command with a separate write instruction? If we write the Run Command to the drive along with the Speed Reference, Direction, External Fault, and Fault Reset Commands, we can keep the parameter addresses in sequence, and we can update all five of the commands with one write instruction. This method is valid only if we disable the drive’s keypad STOP button (P3.00 = 04). Typically, the keypad STOP button will be enabled (P3.00 = 03), and we need to prevent a change in one of the other commands from overriding a keypad Stop Command by causing a previous Run Command to be rewritten to the drive. By using a separate Run Command write instruction, only a deliberate Run Command change by the program will run the drive again after a stop. Block Transfer Parameters For writing to any of the parameters from P0.00 to P8.01, a group of 15 block transfer parameters (P9.11 to P9.25) is available in the GS2 AC drive. This sequential block of parameters can be used to "group" various miscellaneous non-sequential parameters, so that you can update the parameters in one programming write block instead of having to use multiple WX commands. For example: If you need to change the PID setpoint (P7.11), accel time (P1.01), and multi-speed 1 (P5.01), this would typically take three different WX commands because the parameters are non-sequential. However, by setting P9.11 to P7.11, P9.12 to P1.01, and P9.13 to P5.01, the parameters become sequential, and can be controlled using one WX command (LD Kf201, LD K6, LDA Oxxxx, WX V4413).

1st Ed. Rev. C

12/2006

GS2 Series AC Drive User Manual

5–29

Page 134

Chapter 5: GS2 Modbus Communications

Communicating with Third-party Devices First you must decide what type of interface will work best for your application. The GS2 RJ-12 Serial Comm Port can accommodate an RS232C or an RS-485 connection. RS-232C An RS-232C connection is somewhat limited. The maximum network cable length for an RS-232C connection is 15 meters (50 feet). In addition, using the RS-232C interface will allow you to connect only one AC drive to one Modbus device. For an RS-232C connection, set the GS2 DIP switches SW2 and SW3 to RS232. RJ-12 (6P4C) Serial Comm Port

6

1

RS-232C Interface 2: GND 3: RXD 4: TXD 5: +5V

RS485

SW3

SW2

Switches SW2 and SW3 must be set to RS232 for an RS-232C connection.

RS232

RS-485 An RS-485 network cable can span up to 1000 meters (4000 feet). For an RS-485 connection, set the GS2 DIP switches SW2 and SW3 to RS485. RJ-12 (6P4C) Serial Comm Port

6

1

RS-485 Interface 2: GND 3: SG4: SG+ 5: +5V

RS485

SW3

SW2

Switches SW2 and SW3 must be set to RS485 for an RS-485 connection.

RS232

The GS2 Series AC drive communication address is specified by P9.00. The third party device then controls each AC drive according to its communication address. The GS2 Series AC drive can be setup to communicate on standard Modbus networks using the following transmission modes: ASCII or RTU. Using the Communication Protocol parameter (P9.02), you can select the desired mode, data bits, parity, and stop bits. The mode and serial parameters must be the same for all devices on a Modbus network.

5–30

GS2 Series AC Drive User Manual

Page 135

Chapter 5: GS2 Modbus Communications

Data Format ASCII Mode: 10-bit character frame (For 7-bit character): P9.02 = 00 (7 data bits, no parity, 2 stop bits) Start bit

0

1

2

3

4

5

6

Stop Stop bit bit

5

6

Even Stop parity bit

5

6

Odd Stop parity bit

7-bit character 10-bit character frame

P9.02 = 01 (7 data bits, even parity, 1 stop bit) Start bit

0

1

2

3

4

7-bit character 10-bit character frame

P9.02 = 02 (7 data bits, odd parity, 1 stop bit) Start bit

0

1

2

3

4

7-bit character 10-bit character frame

RTU Mode: 11-bit character frame (For 8-bit character): P9.02 = 03 (8 data bits, no parity, 2 stop bit) Start bit

0

1

2

3

4

5

6

7

Stop Stop bit bit

6

7

Even Stop parity bit

6

7

Odd Stop parity bit

8-bit character 11-bit character frame

P9.02 = 04 (8 data bits, even parity, 1 stop bit) Start bit

0

1

2

3

4

5

8-bit character 11-bit character frame

P9.02 = 05 (8 data bits, odd parity, 1 stop bit) Start bit

0

1

2

3

4

5

8-bit character 11-bit character frame

1st Ed. Rev. C

12/2006

GS2 Series AC Drive User Manual

5–31

Page 136

Chapter 5: GS2 Modbus Communications

Communication Protocol ASCII Mode: STX

Start Character: (3AH)

ADR 1 ADR 0 CMD 1

Communication Address: 8-bit address consists of 2 ASCII codes

CMD 0 DATA (n-1) .......

Contents of data: n x 8-bit data consists of 2n ASCII codes. n ≤ 25 maximum of 50 ASCII codes

DATA 0 LRC CHK 1 LRC CHK 0 END 1 END-0

LRC check sum: 8-bit check sum consists of 2 ASCII codes END characters: END 1 = CR (0DH), END 0 = LF (0AH)

RTU Mode: START

A silent interval of more than 10 ms

ADR

Communication Address: 8-bit address

CMD

Command Code: 8-bit command

DATA (n-1) Contents of data: n x 8-bit data, n ≤ 25

....... DATA 0 CRC CHK Low CRC CHK High

CRC check sum: 16-bit check sum consists of 2 8-bit characters

END

A silent interval of more than 10 ms

ADR (Communication Address) Valid communication addresses are in the range of 0 to 254. Communication address equals to 0 means broadcast to all AC drives, in which case the drives will not reply any message to the master device. For example, communication to AC drive with address 16 decimal: ASCII mode: (ADR 1, ADR 0)='1','0' => '1'=31H, '0'=30H RTU mode: (ADR)=10H

5–32

GS2 Series AC Drive User Manual

Page 137

Chapter 5: GS2 Modbus Communications

CMD (Command code) and DATA (data characters) The format of data characters depends on the command code. The available command codes are described as followed: Command code: 03H, read N words. The maximum value of N is 12. For example, reading continuous 2 words from starting address 2102H of the AC drive with address 01H. ASCII mode: Command Message

Response Message

STX

':'

STX ':'

':'

ADR 1 ADR 0

'0'

ADR 1 ADR 0

'0'

CMD 1 CMD 0

'0'

CMD 1 CMD 0

'0'

Number of data (Count by byte)

'0'

'1' '3' '2'

Starting data address

'1' '0'

'3' '4' '1'

Content of starting data address 2102H

'2' '0' Number of data (Count by word)

'1'

'7' '7'

'0'

'0'

'0'

'0'

'2' LRC CHK 1 LRC CHK 0

'D'

END 1 END 0

CR

Content data address 2103H

'7'

'0' '0' '0'

LF

LRC CHK 1 LRC CHK 0

'7'

END 1 END 0

CR

'1' LF

RTU mode: Command Message

1st Ed. Rev. C

12/2006

Response Message

ADR

01H

ADR

01H

CMD

03H

CMD

03H

Starting data address

21H

Number of data (Count by byte)

04H

Number of data (Count by word)

00H

Content of data address 2102H

17H

CRC CHK Low CRC CHK High

6FH

Content of data address 2103H

00H

CRC CHK Low CRC CHK High

FEH

02H 02H F7H

'0' 70H 02H 5CH

GS2 Series AC Drive User Manual

5–33

Page 138

Chapter 5: GS2 Modbus Communications

Command code: 06H, write 1 word For example, writing 6000(1770H) to address 0100H of the AC drive with address 01H. ASCII mode: Command Message

Response Message

STX

':'

STX ':'

':'

ADR 1 ADR 0

'0'

ADR 1 ADR 0

'0'

CMD 1 CMD 0

'0'

CMD 1 CMD 0

'0'

'1' '6' '0' '1' '0'

Data Address

'1' '6' '0'

Data Address

'1' '0'

'0'

'0'

'1'

'1'

'7' '7'

Data Content

'0' LRC CHK 1 LRC CHK 0

'7'

END 1 END 0

CR

'1' LF

'7' '7' '0'

LRC CHK 1 LRC CHK 0

'7'

END 1 END 0

CR

'1' LF

RTU mode: This is an example of using function code 16 for writing to multiple registers. Command Message ADR

01H

ADR

01H

CMD

10H

CMD

10H

Starting data address

20H

Starting data address

20H

Number of data (Count by word)

00H

CRC CHK Low CRC CHK High

4AH

Number of registers

5–34

Response Message

00H 00H 02H

Byte count

04H

Content of data address 2000H

00H

Content of data address 2001H

02H

CRC CHK Low CRC CHK High

CBH

02H 58H 34H

GS2 Series AC Drive User Manual

00H 02H 08H

Page 139

Chapter 5: GS2 Modbus Communications

CHK (check sum) ASCII Mode: LRC (Longitudinal Redundancy Check) is calculated by summing up module 256, the values of the bytes from ADR1 to last data character then calculating the hexadecimal representation of the 2's-complement negation of the sum. For example, reading 1 word from address 0401H of the AC drive with address 01H. Command Message STX

':'

ADR 1 ADR 0

'0'

CMD 1 CMD 0

'0'

'1' '3' '0'

Starting data address

'4' '0' '1' '0'

Number of data (Count by word)

'0'

01H+03H+04H+01H+00H+01H=0AH; the 2's complement negation of 0AH is F6H.

'0' '1'

LRC CHK 1 LRC CHK 0 END 1 END 0

'F' '6' CR LF

RTU Mode: Response Message

1st Ed. Rev. C

ADR

01H

CMD

03H

Starting data address

21H

Number of data (Count by word)

00H

CRC CHK Low CRC CHK High

6FH

12/2006

02H 02H F7H

GS2 Series AC Drive User Manual

5–35

Page 140

Chapter 5: GS2 Modbus Communications

CRC (Cyclical Redundancy Check) is calculated by the following steps: Step 1: Load a 16-bit register (called CRC register) with FFFFH. Step 2: Exclusive OR the first 8-bit byte of the command message with the low order byte of the 16-bit CRC register, putting the result in the CRC register. Step 3: Shift the CRC register one bit to the right with MSB zero filling. Extract and examine the LSB. Step 4: If the LSB of CRC register is 0, repeat step 3; else Exclusive OR the CRC register with the polynomial value A001H. Step 5: Repeat step 3 and 4 until eight shifts have been performed. When this is done, a complete 8-bit byte will have been processed. Step 6: Repeat steps 2 to 5 for the next 8-bit byte of the command message.

Continue doing this until all bytes have been processed. The final contents of the CRC register are the CRC value. Note: When transmitting the CRC value in the message, the upper and lower bytes of the CRC value must be swapped, i.e. the lower order byte will be transmitted first.

The following is an example of CRC generation using C language. The function takes two arguments: Unsigned char* data ← a pointer to the message buffer Unsigned char length ← the quantity of bytes in the message buffer The function returns the CRC value as a type of unsigned integer. Unsigned int crc_chk(unsigned char* data, unsigned char length){ int j; unsigned int reg_crc=0xFFFF; while(length--){ reg_crc ^= *data++; for(j=0;j<8;j++){ if(reg_crc & 0x01){ /* LSB(b0)=1 */ reg_crc=(reg_crc>>1) ^ 0xA001; }else{ reg_crc=reg_crc >>1; } } } return reg_crc; }

5–36

GS2 Series AC Drive User Manual