background image

Access from the user program

KL6781

25

Version: 2.0.0

4.6

Examples of Register Communication

The numbering of the bytes in the examples corresponds to the display without word alignment.

4.6.1

Example 1: reading the firmware version from Register 9

Output Data

Byte 0: Control byte

Byte 1: DataOUT1, high byte

Byte 2: DataOUT1, low byte

0x89 (1000 1001

bin

)

0xXX

0xXX

Explanation:

• Bit 0.7 set means: Register communication switched on.

• Bit 0.6 not set means: reading the register.

• Bits 0.5 to 0.0 specify the register number 9 with 00 1001

bin

.

• The output data word (byte 1 and byte 2) has no meaning during read access. To change a register,

write the required value into the output word.

Input Data (answer of the bus terminal)

Byte 0: Status byte

Byte 1: DataIN1, high byte

Byte 2: DataIN1, low byte

0x89

0x33

0x41

Explanation:

• The terminal returns the value of the control byte as a receipt in the status byte.

• The terminal returns the firmware version 0x3341 in the input data word (byte 1 and byte 2). This is to

be interpreted as an ASCII code:

◦ ASCII code 0x33 represents the digit 3

◦ ASCII code 0x41 represents the letter A

The firmware version is thus 3A.

4.6.2

Example 2: Writing to an user register

Note

Code word

In normal mode all user registers are read-only with the exception of Register 31. In order
to deactivate this write protection you must write the code word (0x1235) into Register 31. If
a value other than 0x1235 is written into Register 31, write protection is reactivated. Please
note that changes to a register only become effective after restarting the terminal (power-
off/power-on).

I. Write the code word (0x1235) into Register 31.

Output Data

Byte 0: Control byte

Byte 1: DataOUT1, high byte

Byte 2: DataOUT1, low byte

0xDF (1101 1111

bin

)

0x12

0x35

Explanation:

• Bit 0.7 set means: Register communication switched on.

• Bit 0.6 set means: writing to the register.

• Bits 0.5 to 0.0 specify the register number 31 with 01 1111

bin

.

• The output data word (byte 1 and byte 2) contains the code word (0x1235) for deactivating write

protection.

Содержание KL6781

Страница 1: ...Documentation KL6781 M Bus Master Terminals 2 0 0 2018 01 16 Version Date...

Страница 2: ......

Страница 3: ...d mechanical load capacity 13 3 3 Connection 14 3 3 1 Connection system 14 3 3 2 Wiring 16 3 3 3 Connection 17 4 Access from the user program 18 4 1 Register Overview 18 4 2 Control and status word 19...

Страница 4: ...Table of contents KL6781 4 Version 2 0 0...

Страница 5: ...e data diagrams and descriptions in this documentation Trademarks Beckhoff TwinCAT EtherCAT Safety over EtherCAT TwinSAFE XFC and XTS are registered trademarks of and licensed by Beckhoff Automation G...

Страница 6: ...iliar with the applicable national standards Description of symbols In this documentation the following symbols are used with an accompanying safety instruction or note The safety instructions must be...

Страница 7: ...on extended M bus chapter added Programming chapter extended 1 0 0 First release Firmware and hardware versions Documentation Version KL6781 Firmware Hardware 2 0 0 1C 03 1 4 0 1B 01 1 3 0 1B 01 1 2 0...

Страница 8: ...icity water gas or energy meters The KL6781 does not contain the M bus protocol but converts the K bus data to an M bus compliant format On the K bus 24 bytes are available for this purpose for each M...

Страница 9: ...e process image input output 24 bytes Configuration TwinCAT PLC M bus function blocks Rated voltage 24 VDC 15 20 Input voltage 24 VDC 15 20 Weight approx 60 g Mounting 11 on 35 mm mounting rail confor...

Страница 10: ...his LED indicates the terminal s operating state on Normal operation off The RUN LED goes out if no process data is transmitted to the terminal from the Bus Coupler for 100 ms Error red General error...

Страница 11: ...ieldbus Coupler Join the compo nents with tongue and groove and push the terminals against the mounting rail until the lock clicks onto the mounting rail If the Terminals are clipped onto the mounting...

Страница 12: ...s The six spring contacts of the K Bus E Bus deal with the transfer of the data and the supply of the Bus Terminal electronics The power contacts deal with the supply for the field electronics and thu...

Страница 13: ...nts for testing these Power Feed Terminals can be released and pulled at least 10 mm from the group of terminals WARNING Risk of electric shock The PE power contact must not be used for other potentia...

Страница 14: ...lief and the wire connection should be kept as short as possible A distance of approx 10 cm should be maintained to the cable duct 3 3 Connection 3 3 1 Connection system WARNING Risk of electric shock...

Страница 15: ...ion wires when the connector is removed Conductor cross sections between 0 08 mm2 and 2 5 mm2 can continue to be used with the proven spring force technology The overview and nomenclature of the produ...

Страница 16: ...t toggle 2 The wire can now be inserted into the round terminal opening without any force 3 The terminal point closes automatically when the pressure is released holding the wire securely and permanen...

Страница 17: ...5 mm2 Wire stripping length 8 9 mm 3 3 3 Connection Fig 10 Connection Terminal point Name Signal 1 reserved 2 M bus M bus plus internally connected to terminal point 6 3 M bus M bus minus internally...

Страница 18: ...R3 Number of framing errors 0x0000 0dec R R4 reserved 0x0000 0dec R R5 reserved 0x0000 0dec R R6 23 Diagnostic register variable variable R RAM R7 23 Command register 0x0000 0dec R W RAM R8 23 Termin...

Страница 19: ...ions are disabled the FIFO pointers are reset and the interface is initialized with the values in the appropriate registers The terminal acknowledges completion of the initialization via bit SW 2 19 I...

Страница 20: ...of this bit Only then new data can be transferred from the terminal to the controller Register communication Control word in register communication The control word CW is located in the output process...

Страница 21: ...cess data mode operation of the terminal The KL6781 is represented with its complex process image even if you set your Bus Coupler to a compact process image The KL6781 is represented in the process i...

Страница 22: ...d with a compact process image without control and status word since the control and status words are required for meaningful process data mode operation of the terminal The KL6781 is represented with...

Страница 23: ...bus master terminal They can be read or written by means of the register communication R0 Number of data bytes in the send buffer Register R0 contains the number of data in the transmit FIFO R1 Numbe...

Страница 24: ...hout first entering the user code word 0x1235 into the code word register the terminal will not accept the supplied data If you write values into the user registers and have previously entered the use...

Страница 25: ...eturns the firmware version 0x3341 in the input data word byte 1 and byte 2 This is to be interpreted as an ASCII code ASCII code 0x33 represents the digit 3 ASCII code 0x41 represents the letter A Th...

Страница 26: ...Byte 1 DataIN1 high byte Byte 2 DataIN1 low byte 0x9F 1001 1111bin 0x12 0x35 Explanation The terminal returns the value of the control byte as a receipt in the status byte The terminal returns the cu...

Страница 27: ...yte 0 Status byte Byte 1 DataIN1 high byte Byte 2 DataIN1 low byte 0xA0 1010 0000bin 0x00 0x02 Explanation The terminal returns the value of the control byte as a receipt in the status byte The termin...

Страница 28: ...re line that is protected against polarity reversal With primary addressing up to 250 slaves can be connected in star strand or tree topologies Ring structures are not permitted Devices from different...

Страница 29: ...tar line and tree topology Fig 12 Star line and tree topology Ring topology Fig 13 Ring topology Note Ring topology is not supported Although ring topology is possible with the M bus it is not recomme...

Страница 30: ...Programming KL6781 30 Version 2 0 0 6 Programming 6 1 TwinCAT libraries Software documentation in the Beckhoff Information System TwinCAT 2 TwinCAT 2 PLC Lib M bus TwinCAT 3 TwinCAT 3 PLC Lib Tc2_MBus...

Страница 31: ...components there Beckhoff Headquarters Beckhoff Automation GmbH Co KG Huelshorstweg 20 33415 Verl Germany Phone 49 0 5246 963 0 Fax 49 0 5246 963 198 e mail info beckhoff com Beckhoff Support Support...

Страница 32: ...rail 11 Fig 4 Disassembling of terminal 12 Fig 5 Power contact on left side 13 Fig 6 Standard wiring 14 Fig 7 Pluggable wiring 15 Fig 8 High Density Terminals 15 Fig 9 Connecting a cable on a terminal...

Отзывы: