《台达PLC通信协议.doc》由会员分享,可在线阅读,更多相关《台达PLC通信协议.doc(15页珍藏版)》请在三一文库上搜索。
1、DELTA DVP Series PLCCOMMUNICATION PROTOCOL VER 1.01. Communication Interface: RS-232C2. Communication Protocol ASCII mode, 9600(Baud rate), EVEN(Parity), 1(Start bit),1(Stop bit)3. Communication Data FrameSTXStart character :(3AH)ADR 1Communication address:ADR 0 8-bit address consists of 2 ASCII cod
2、esCMD 1Command code:CMD 0 8-bit command consists of 2 ASCII codesDATA(0)Contents of data:DATA(1) n8-bit data consist of 2n ASCII codes. . n37, maximum of 74 ASCII codesDATA(n-1)LRC CHK 1LRC check sum:LRC CHK 0 8-bit check sum consists of 2 ASCII codesEND 1End character:END 0END 1 = CR(0DH),END 0 = L
3、F(0AH)n ADR(Communication Address)Valid communication addresses are in the range of 031. 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,01=31H, 0 = 30Hn C
4、MD (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 NameExample (Hex)Heading3ASlave Address01Command code03Starting Address Hi 06Starting Addres
5、s Lo 14Number of Points Hi00Number of Points Lo08Error Check ( LRC )DANumber of Points(max) = 18(for 16 bit register)= 9(for 32 bit register)Example:Reading Coils T20T27 from slave device 01PCPLC “:01 03 06 14 00 08 DA CR LF”PLCPC “:01 03 10 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 B8 CR LF”F
6、ield NameExample (Hex)Slave Address01Command code03Bytes Count10Data Hi(T20)00Data Lo(T20)01Data Hi(T21)00Data Lo(T21)02Data Hi(T22)00Data Lo(T22)03Data Hi(T23)00Data Lo(T23)04Data Hi(T24)00Data Lo(T24)05Data Hi(T25)00Data Lo(T25)06Data Hi(T26)00Data Lo(T26)07Data Hi(T27)00Data Lo(T27)08Error Check(
7、LRC)C8n 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 2s-complement negation of the sum. For example, reading 1 word form address 0401H of
8、the PLC with address 01HSTX:ADR 10ADR 01CMD 10CMD 03Starting data address0401Number of data0001LRC CHK 1FLRC CHK 06END 1CREND 0LF01H+03H+04H+01H+00+01H = 0AHthe 2s-complement negation of 0AH is F6HException response:The PLC is been expected to return a normal response after receiving command message
9、s 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
10、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.An ex
11、ample of exception response of command code 01H and exception 02H:Command message:Field NameExample (Hex)Heading3ASlave Address01Function01Starting Address Hi 04Starting Address Lo 00Number of Points Hi00Number of Points Lo10Error Check ( LRC )EAResponse message:Field NameExample (Hex)Heading3ASlave
12、 Address01Function81Exception Code 02Error Check ( LRC )7CException code:Meaning:01Illegal command code:The command code received in the command message is not available for the PLC.02Illegal device address:The device address received in the command message is not available for the PLC.03Illegal dev
13、ice value:The device value received in the command message is not available for the PLC.07Check Sum ErrorCheck if the check Sum is correctIllegal command messagesThe command message is too short.Command message length is out of range.u The format of data characters depends on the command. The availa
14、ble command codes are described as followed, CodeNameDescription01Read Coil StatusS, Y, M, T, C02Read Input StatusS, X, Y, M,T, C03Read Holding RegistersT, C, D05Force Single CoilS, Y, M, T, C06Preset Single RegisterT, C, D15Force Multiple CoilsS, Y, M, T, C16Preset Multiple RegisterT, C, D17Report
15、Slave ID NoneDELTA DVP-ES Series PLC DEVICE ADDRESSDeviceRangeEffective RangeAddressS000255000127000000FFS256511010001FFS512767020002FFS7681023030003FFX000377 (Octal)000177 (Octal)040004FFY000377 (Octal)000177 (Octal)050005FFT000255000127060006FFM00025500001279080008FFM256511090009FFM5127670A000AFFM
16、76810230B000BFFM102412790C000CFFC0002550001272322550E000EFFD00025500059910001143100010FFD256511110011FFD512767120012FFD7681023130013FFD10241279140014FFCommand Code:01, Read Coil StatusField NameExample (Hex)Heading3ASlave Address01Command code01Starting Address Hi 06Starting Address Lo 14Number of P
17、oints Hi00Number of Points Lo25Error Check ( LRC )BFNumber of Points(max) = 255 = 0x00FFExample:Reading Coils T20T56 from slave device 01PCPLC “:01 01 06 14 00 25 BF CR LF”PLCPC “:01 01 05 CD 6B B2 0E 1B D6 CR LF”Field NameExample (Hex)Slave Address01Command code01Bytes Count05Data(Coils T27T20)CDDa
18、ta(Coils T35T38)6BData(Coils T43T36)B2Data(Coils T51T44)0EData(Coils T56T52)1BError Check(LRC)E6n Command Code:02, Read Input StatusField NameExample (Hex)Heading3ASlave Address01Command code02Starting Address Hi 05Starting Address Lo 14Number of Points Hi00Number of Points Lo25Error Check ( LRC )BF
19、Example:Reading Contact Y024Y070 from slave device 01PCPLC “:01 02 05 14 00 25 BF CR LF”PLCPC “:01 02 05 CD 6B B2 0E 1B E5 CR LF”Field NameExample (Hex)Slave Address01Command code02Bytes Count05Data(Coils Y033Y024)CDData(Coils Y043Y034)6BData(Coils Y053Y044)B2Data(Coils Y063Y054)0EData(Coils Y070Y06
20、4)1BError Check(LRC)E5n Command Code:03, Read Holding RegisterHolding Register:T, C, DField NameExample (Hex)Heading3ASlave Address01Command code03Starting Address Hi 06Starting Address Lo 14Number of Points Hi00Number of Points Lo08Error Check ( LRC )DANumber of Points(max) = 18(for 16 bit register
21、)= 9(for 32 bit register)Example:Reading Coils T20T27 from slave device 01PCPLC “:01 03 06 14 00 08 DA CR LF”PLCPC “:01 03 10 00 01 00 02 00 03 00 04 00 05 00 06 00 07 00 08 B8 CR LF”Field NameExample (Hex)Slave Address01Command code03Bytes Count10Data Hi(T20)00Data Lo(T20)01Data Hi(T21)00Data Lo(T2
22、1)02Data Hi(T22)00Data Lo(T22)03Data Hi(T23)00Data Lo(T23)04Data Hi(T24)00Data Lo(T24)05Data Hi(T25)00Data Lo(T25)06Data Hi(T26)00Data Lo(T26)07Data Hi(T27)00Data Lo(T27)08Error Check(LRC)C8n Command Code:05, Force Single CoilField NameExample (Hex)Heading3ASlave Address01Command code05Coil Address
23、Hi 05Coil Address Lo 00Force Data HiFFForce Data Lo00Error Check ( LRC )F6MMNN = 0xFF00.Coil ONMMNN = 0x0000.Coil OFF Example:Forcing Coil Y000 ONPCPLC “:01 05 05 00 FF 00 F6 CR LF”PLCPC “:01 05 05 00 FF 00 F6 CR LF”Field NameExample (Hex)Heading3ASlave Address01Command code05Coil Address Hi 05Coil
24、Address Lo 00Force Data HiFFForce Data Lo00Error Check ( LRC )F6n Command Code:06, Preset Single RegisterField NameExample (Hex)Heading3ASlave Address01Command code06Register Address Hi 06Register Address Lo 00Preset Data Hi12Preset Data Lo34Error Check ( LRC )ADExample:Setting Register T0 to 00 03P
25、CPLC “:01 06 06 00 12 34 AD CR LF”PLCPC “:01 06 06 00 12 34 AD CR LF”Field NameExample (Hex)Heading3ASlave Address01Command code06Register T0 Address Hi 06Register T0 Address Lo 00Preset Data Hi12Preset Data Lo34Error Check ( LRC )ADSwitch ( c )Case 0:T0Q :01 06 06 00 12 34 AD CR LFCase 1:C0Q :01 06
26、 0E 00 12 34 AF CR LFCase 2:C232Q :01 06 0E E8 12 34 56 78 EF CR LFCase 3:D10Q :01 06 10 0A 12 34 99 CR LFCase 4:D1000Q :01 06 13 E8 12 34 BA CR LFn Command Code:15, Force Multiple CoilsField NameExample (Hex)Heading3ASlave Address01Command code0FCoil Address Hi05Coil Address Lo00Quantity of Coils H
27、i00Quantity of Coils Lo0AByte Count02Force Data HiCDForce Data Lo01Error Check (LRC)11Quantity of Coils (max) = 255Example:Setting Coil Y007Y000 = 1100 1101, Y011Y010 = 01.PCPLC “:01 0F 05 00 00 0A 02 CD 01 11 CR LF”PLCPC “:01 0F 05 00 00 0A E1 CR LF”Field NameExample (Hex)Heading3ASlave Address01Co
28、mmand code0FRegister T0 Address Hi 05Register T0 Address Lo 00Preset Data Hi00Preset Data Lo0AError Check ( LRC )E1n Command Code:16, Preset Multiple RegisterField NameExample (Hex)Heading3ASlave Address01Command code10Starting Address Hi 06Starting Address Lo 00Number of Register Hi00Number of Regi
29、ster Lo02Byte Count04Data Hi00Data Lo0AData Hi01Data Lo02Error Check (LRC)C6Number of Register(max) = 16(for 16 bit register)= 8(for 8 bit register)Example:Setting Register T0 to 00 0A, T1 to 01 02.PCPLC “:01 10 06 00 02 00 04 00 0A 01 02 D6 CR LF”PLCPC “:01 10 06 00 00 02 E7 CR LF”Field NameExample
30、 (Hex)Heading3ASlave Address01Command code10Starting Address Hi 06Starting Address Lo 00Number of Registers Hi00Number of Registers Lo02Error Check ( LRC )E7n Command Code:17, Report Slave IDReturns a description of controller present at the slave address, the current status of the slave Run indicat
31、or, and other information specific to the slave device.Command message:Field NameExample (Hex)Heading3ASlave Address01Command code11Error Check (LRC)EEResponse message:Field NameExample (Hex)Heading3ASlave Address01Command code11Byte Count04Slave ID01Run Indicator Status00 = OFFFF = ONFFData 0(D1001
32、 HI)40Data 1(D1001 LOW)10Error Check (LRC)9An DVP Series PLC Internal Device Communication AddressDeviceRangeTypeAddressEffective rangeES/EX/SSSA/SX/SHEHS000255bit000000FF01270102401024S246511bit010001FFS512767bit020002FFS7681023bit030003FFX000377 (Octal)bit040004FF01770177000377Y000377 (Octal)bit05
33、0005FFT000255bit/word060006FF 0127000255000255M000255bit080008FF012790409500004095M256511bit090009FFM512767bit0A000AFFM7681023bit0B000BFFM10241279bit0C000CFFM12801535bit0D000DFFM15361791bitB000B0FFM17922047bitB100B1FFM20482303bitB200B2FFM23042559bitB300B3FFM25602815bitB400B4FFM28163071bitB500B5FFM30
34、723327bitB600B6FFM33283583bitB700B7FFM35843839bitB800B8FFM38404095bitB900B9FFC019916-bitbit/word0E000EC701270199019920025532-bitbit/Dword0EC80EFF232255200255200255DeviceRangeTypeAddressEffectiveES/EX/SSSA/SX/SHEHD000256word100010FF013110499900009999D256511word110011FFD512767word120012FFD7681023word1
35、30013FFD10241279word140014FFD12801535word150015FFD15361791word160016FFD17922047word170017FFD20482303word180018FFD23042559word190019FFD25602815word1A001AFFD28163071word1B001BFFD30723327word1C001CFFD33283583word1D001DFFD35843839word1E001EFFD38404095word1F001FFFD40964351word900090FFD43524607word910091F
36、FD46084863word920092FFD48645119word930093FFD51205375word940094FFD53765631word950095FFD56325887word960096FFD58886143word970097FFD61446399word980098FFD64006655word990099FFD66566911word9A009AFFD69127167word9B009BFFD71687423word9C009CFFD74247679word9D009DFFD76807935word9E009EFFD79368191word9F009FFFD81928447wordA000A0FFD84488703wordA100A1FFD87048959wordA200A2FFD89609215wordA300A3FFD92169471wordA400A4FFD94729727wordA500A5FFD97289983wordA600A6FFD99849999wordA700A70F