DELTA DVP Series PLC COMMUNICATION PROTOCOL VER 1.0 DELTA ELECTRONICS, INC. 1 1. Communication Interface: RS-232C 2. Communication Protocol ASCII mode, 9600(Baud rate),7(Data length), EVEN(Parity),1 (Stop bit) 3. Communication Data Frame STX ADR 1 ADR 0 CMD 1 CMD 0 DATA(0) DATA(1) ………. DATA(n-1) LRC CHK 1 LRC CHK 0 END 1 END 0 Start character ‘:’(3AH) Communication address: 8-bit address consists of 2 ASCII codes Command code: 8-bit command consists of 2 ASCII codes Contents of data: n8-bit data consist of 2n ASCII codes. n37, maximum of 74 ASCII codes LRC check sum: 8-bit check sum consists of 2 ASCII codes End character: END 1 = CR(0DH),END 0 = LF(0AH) ADR(Communication Address) Valid communication addresses are in the range of 0…31. Communication address equals to 0 means broadcast to all PLC, the PLC will reply normal message to the master device. For example, communication to PLC with address 16 decimal: (ADR 1, ADR 0)=’1’,’0’’1’=31H, ‘0’ = 30H CMD (Command code) and DATA (data characters) The format of data characters depends on the command code. For example, reading continuous 8 words form starting device address 0614H of PLC with address 01H. Field Name Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Points Hi Number of Points Lo Error Check ( LRC ) Number of Points(max) = 18(for 16 bit register) = 9(for 32 bit register) Example (Hex) 3A 01 03 06 14 00 08 DA 2 Example:Reading Coils T20~T27 from slave device 01 PC→PLC “:01 03 06 14 00 08 DA CR LF” PLC→PC “:01 03 10 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 B8 CR LF” Field Name Slave Address Command code Bytes Count Data Hi(T20) Data Lo(T20) Data Hi(T21) Data Lo(T21) Data Hi(T22) Data Lo(T22) Data Hi(T23) Data Lo(T23) Data Hi(T24) Data Lo(T24) Data Hi(T25) Data Lo(T25) Data Hi(T26) Data Lo(T26) Data Hi(T27) Data Lo(T27) Error Check(LRC) Example (Hex) 01 03 10 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 C8 LRC CHK(check sum) 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. 3 For example, reading 1 word form address 0401H of the PLC with address 01H STX ADR 1 ADR 0 CMD 1 CMD 0 Starting data address Number of data LRC CHK 1 LRC CHK 0 END 1 END 0 ‘:’ ‘0’ ‘1’ ‘0’ ‘3’ ‘0’ ‘4’ ‘0’ ‘1’ ‘0’ ‘0’ ‘0’ ‘1’ ‘F’ ‘6’ CR LF 01H+03H+04H+01H+00+01H = 0AH the 2’s-complement negation of 0AH is F6H Exception response: The PLC is been expected to return a normal response after receiving command messages from the master device. The following depicts the conditions that no normal response is replied to the master device. The PLC does not receive the messages due to a communication error; thus the PLC has no response. The master device will eventually process a timeout condition. The PLC receives the messages without a communication error, but cannot handle it, an exception response will return to the master device. In the exception response, the most significant bit of the original command code is set to 1, and an exception code explains the condition that caused the exception is returned. 4 An example of exception response of command code 01H and exception 02H: Command message: Field Name Heading Slave Address Function Starting Address Hi Starting Address Lo Number of Points Hi Number of Points Lo Error Check ( LRC ) Example (Hex) 3A 01 01 04 00 00 10 EA Response message: Field Name Heading Slave Address Function Exception Code Error Check ( LRC ) Exception code: 01 02 03 07 Example (Hex) 3A 01 81 02 7C Meaning: Illegal command code: The command code received in the command message is not available for the PLC. Illegal device address: The device address received in the command message is not available for the PLC. Illegal device value: The device value received in the command message is not available for the PLC. Check Sum Error Check if the check Sum is correct Illegal command messages The command message is too short. Command message length is out of range. 5 The format of data characters depends on the command. The available command codes are described as followed, Code 01 02 03 05 06 15 16 17 Name Description Read Coil Status Read Input Status Read Holding Registers Force Single Coil Preset Single Register Force Multiple Coils Preset Multiple Register Report Slave ID S, Y, M, T, C S, X, Y, M,T, C T, C, D S, Y, M, T, C T, C, D S, Y, M, T, C T, C, D None DELTA DVP-ES Series PLC DEVICE ADDRESS Device Range S S S S X Y T M M M M M 000~255 246~511 512~767 768~1023 000~377 (Octal) 000~377 (Octal) 000~255 000~255 256~511 512~767 768~1023 1024~1279 C 000~255 D D D D D 000~255 256~511 512~767 768~1023 1024~1279 Effective Range 000~127 000~177 (Octal) 000~177 (Octal) 000~127 0000~1279 Address 0000~00FF 0100~01FF 0200~02FF 0300~03FF 0400~04FF 0500~05FF 0600~06FF 0800~08FF 0900~09FF 0A00~0AFF 0B00~0BFF 0C00~0CFF 000~127 232~255 0E00~0EFF 000~599 1000~1143 1000~10FF 1100~11FF 1200~12FF 1300~13FF 1400~14FF 6 Command Code:01, Read Coil Status Field Name Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Points Hi Number of Points Lo Error Check ( LRC ) Example (Hex) 3A 01 01 06 14 00 25 BF Number of Points(max) = 255 = 0x00FF Example:Reading Coils T20~T56 from slave device 01 PC→PLC “:01 01 06 14 00 25 BF CR LF” PLC→PC “:01 01 05 CD 6B B2 0E 1B D6 CR LF” Field Name Example (Hex) Slave Address Command code Bytes Count Data(Coils T27…T20) Data(Coils T35…T38) Data(Coils T43…T36) Data(Coils T51…T44) Data(Coils T56…T52) Error Check(LRC) 01 01 05 CD 6B B2 0E 1B E6 Command Code:02, Read Input Status Field Name Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Points Hi Number of Points Lo Error Check ( LRC ) Example (Hex) 3A 01 02 05 14 00 25 BF Example:Reading Contact Y024~Y070 from slave device 01 PC→PLC “:01 02 05 14 00 25 BF CR LF” PLC→PC “:01 01 05 CD 6B B2 0E 1B E5 CR LF” 7 Field Name Slave Address Command code Bytes Count Data(Coils Y033…Y024) Data(Coils Y043…Y034) Data(Coils Y053…Y044) Data(Coils Y063…Y054) Data(Coils Y070…Y064) Error Check(LRC) Example (Hex) 01 02 05 CD 6B B2 0E 1B E5 Command Code:03, Read Holding Register Holding Register:T, C, D Field Name Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Points Hi Number of Points Lo Error Check ( LRC ) Example (Hex) 3A 01 03 06 14 00 08 DA Number of Points(max) = 18(for 16 bit register) = 9(for 32 bit register) Example:Reading Coils T20~T27 from slave device 01 PC→PLC “:01 03 06 14 00 08 DA CR LF” PLC→PC “:01 03 10 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 B8 CR LF” Field Name Slave Address Command code Bytes Count Data Hi(T20) Data Lo(T20) Data Hi(T21) Data Lo(T21) Example (Hex) 01 03 10 00 01 00 02 8 Data Hi(T22) Data Lo(T22) Data Hi(T23) Data Lo(T23) Data Hi(T24) Data Lo(T24) Data Hi(T25) Data Lo(T25) Data Hi(T26) Data Lo(T26) Data Hi(T27) Data Lo(T27) Error Check(LRC) 00 03 00 04 00 05 00 06 00 07 00 08 C8 Command Code:05, Force Single Coil Field Name Heading Slave Address Command code Coil Address Hi Coil Address Lo Force Data Hi Force Data Lo Error Check ( LRC ) Example (Hex) 3A 01 05 05 00 FF 00 F6 MMNN = 0xFF00….Coil ON MMNN = 0x0000….Coil OFF Example:Forcing Coil Y000 ON PC→PLC “:01 05 05 00 FF 00 F6 CR LF” PLC→PC “:01 05 05 00 FF 00 F6 CR LF” Field Name Heading Slave Address Command code Coil Address Hi Coil Address Lo Force Data Hi Force Data Lo Error Check ( LRC ) Example (Hex) 3A 01 05 05 00 FF 00 F6 9 10 Command Code:06, Preset Single Register Field Name Heading Slave Address Command code Register Address Hi Register Address Lo Preset Data Hi Preset Data Lo Error Check ( LRC ) Example (Hex) 3A 01 06 06 00 12 34 AD Example:Setting Register T0 to 00 03 PC→PLC “:01 06 06 00 12 34 AD CR LF” PLC→PC “:01 06 06 00 12 34 AD CR LF” Field Name Heading Slave Address Command code Register T0 Address Hi Register T0 Address Lo Preset Data Hi Preset Data Lo Error Check ( LRC ) Example (Hex) 3A 01 06 06 00 12 34 AD Switch ( c ) Case 0:T0 Q →:01 06 06 00 12 34 AD CR LF Case 1:C0 Q →:01 06 0E 00 12 34 AF CR LF Case 2:C232 Q →:01 06 0E E8 12 34 56 78 EF CR LF Case 3:D10 Q →:01 06 10 0A 12 34 99 CR LF Case 4:D1000 Q →:01 06 13 E8 12 34 BA CR LF 11 Command Code:15, Force Multiple Coils Field Name Heading Slave Address Command code Coil Address Hi Coil Address Lo Quantity of Coils Hi Quantity of Coils Lo Byte Count Force Data Hi Force Data Lo Error Check (LRC) Example (Hex) 3A 01 0F 05 00 00 0A 02 CD 01 11 Quantity of Coils (max) = 255 Example:Setting Coil Y007…Y000 = 1100 1101, Y011…Y010 = 01. PC→PLC “:01 0F 05 00 00 0A 02 CD 01 11 CR LF” PLC→PC “:01 0F 05 00 00 0A E1 CR LF” Field Name Heading Slave Address Command code Register T0 Address Hi Register T0 Address Lo Preset Data Hi Preset Data Lo Error Check ( LRC ) Example (Hex) 3A 01 0F 05 00 00 0A E1 12 Command Code:16, Preset Multiple Register Field Name Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Register Hi Number of Register Lo Byte Count Data Hi Data Lo Data Hi Data Lo Error Check (LRC) Example (Hex) 3A 01 10 06 00 00 02 04 00 0A 01 02 C6 Number of Register(max) = 16(for 16 bit register) = 8(for 8 bit register) Example:Setting Register T0 to 00 0A, T1 to 01 02. PC→PLC “:01 10 06 00 02 00 04 00 0A 01 02 D6 CR LF” PLC→PC “:01 10 06 00 00 02 E7 CR LF” Field Name Example (Hex) Heading Slave Address Command code Starting Address Hi Starting Address Lo Number of Registers Hi Number of Registers Lo Error Check ( LRC ) 3A 01 10 06 00 00 02 E7 13 Command Code:17, Report Slave ID Returns a description of controller present at the slave address, the current status of the slave Run indicator, and other information specific to the slave device. Command message: Field Name Heading Slave Address Command code Error Check (LRC) Example (Hex) 3A 01 11 EE Response message: Field Name Example (Hex) Heading Slave Address Command code Byte Count Slave ID Run Indicator Status 00 = OFF FF = ON Data 0(D1001 HI) Data 1(D1001 LOW) Error Check (LRC) 3A 01 11 04 01 FF 40 10 9A 14 DVP Series PLC Internal Device Communication Address Effective range Device S S S S X Y T M M M M M M M M M M M M M M M M C Range 000~255 246~511 512~767 768~1023 000~377 (Octal) 000~377 (Octal) 000~255 000~255 256~511 512~767 768~1023 1024~1279 1280~1535 1536~1791 1792~2047 2048~2303 2304~2559 2560~2815 2816~3071 3072~3327 3328~3583 3584~3839 3840~4095 0~199 16-bit 200~255 32-bit Type bit bit bit bit bit bit bit/word bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit bit/word bit/Dword Address 0000~00FF 0100~01FF 0200~02FF 0300~03FF 0400~04FF 0500~05FF 0600~06FF 0800~08FF 0900~09FF 0A00~0AFF 0B00~0BFF 0C00~0CFF 0D00~0DFF B000~B0FF B100~B1FF B200~B2FF B300~B3FF B400~B4FF B500~B5FF B600~B6FF B700~B7FF B800~B8FF B900~B9FF 0E00~0EC7 0EC8~0EFF 15 ES/EX/SS SA/SX/SH EH 0~127 0~1023 0~1023 0~177 0~177 000~377 0~127 000~255 000~255 0~1279 0~4095 0000~4095 0~127 232~255 0~199 200~255 0~199 200~255 Effective Device D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D D Range 000~256 256~511 512~767 768~1023 1024~1279 1280~1535 1536~1791 1792~2047 2048~2303 2304~2559 2560~2815 2816~3071 3072~3327 3328~3583 3584~3839 3840~4095 4096~4351 4352~4607 4608~4863 4864~5119 5120~5375 5376~5631 5632~5887 5888~6143 6144~6399 6400~6655 6656~6911 6912~7167 7168~7423 7424~7679 7680~7935 7936~8191 8192~8447 8448~8703 8704~8959 8960~9215 9216~9471 9472~9727 9728~9983 9984~9999 Type word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word word Address 1000~10FF 1100~11FF 1200~12FF 1300~13FF 1400~14FF 1500~15FF 1600~16FF 1700~17FF 1800~18FF 1900~19FF 1A00~1AFF 1B00~1BFF 1C00~1CFF 1D00~1DFF 1E00~1EFF 1F00~1FFF 9000~90FF 9100~91FF 9200~92FF 9300~93FF 9400~94FF 9500~95FF 9600~96FF 9700~97FF 9800~98FF 9900~99FF 9A00~9AFF 9B00~9BFF 9C00~9CFF 9D00~9DFF 9E00~9EFF 9F00~9FFF A000~A0FF A100~A1FF A200~A2FF A300~A3FF A400~A4FF A500~A5FF A600~A6FF A700~A70F 16 ES/EX/SS SA/SX/SC EH 0~1311 0~4999 0000~9999