KL6781 M-Bus master terminal
Home


Foreword

Foreword
Foreword
Additional information
•
Notes on the documentation
•
Safety instructions
•
Documentation Issue Status


Notes on the documentation

Foreword [image] Notes on the documentation
Notes on the documentation
Intended audience
This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the documentation and the following notes and explanations are followed when installing and commissioning these components.
It is the duty of the technical personnel to use the documentation published at the respective time of each installation and commissioning.
The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.
Disclaimer
The documentation has been prepared with care. The products described are, however, constantly under development.
We reserve the right to revise and change the documentation at any time and without prior announcement.
No claims for the modification of products that have already been supplied may be made on the basis of the 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 GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.
Patent Pending
The EtherCAT Technology is covered, including but not limited to the following patent applications and patents: EP1590927, EP1789857, DE102004044764, DE102007017835 with corresponding applications or registrations in various other countries.
The TwinCAT Technology is covered, including but not limited to the following patent applications and patents: EP0851348, US6167425 with corresponding applications or registrations in various other countries.
EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany
Copyright
© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Safety instructions

Foreword [image] Safety instructions
Safety instructions
Safety regulations
Please note the following safety instructions and explanations!
Product-specific safety instructions can be found on following pages or in the areas mounting, wiring, commissioning etc.
Exclusion of liability
All the components are supplied in particular hardware and software configurations appropriate for the application. Modifications to hardware or software configurations other than those described in the documentation are not permitted, and nullify the liability of Beckhoff Automation GmbH & Co. KG.
Personnel qualification
This description is only intended for trained specialists in control, automation and drive engineering who are familiar 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 read carefully and followed without fail!
DANGER
Serious risk of injury!
Failure to follow the safety instructions associated with this symbol directly endangers the life and health of persons.
WARNING
Risk of injury!
Failure to follow the safety instructions associated with this symbol endangers the life and health of persons.
CAUTION
Personal injuries!
Failure to follow the safety instructions associated with this symbol can lead to injuries to persons.
Attention
Damage to the environment or devices
Failure to follow the instructions associated with this symbol can lead to damage to the environment or equipment.
Note
Tip or pointer
This symbol indicates information that contributes to better understanding.


Documentation Issue Status

Foreword [image] Documentation Issue Status
Documentation Issue Status
Version
Comment
2.0.0
▪
Migration
1.4.0
▪
Programming description moved to the TwinCAT Information System.
▪
Library updated to version 2.0.1
▪
Technical data updated
1.3.0
▪
Function block FB_MBUS_SBC_ALD1 added
▪
Library updated to version 120
1.2.0
▪
Programming chapter updated
1.1.0
▪
Foreword updated
▪
Mounting instructions extended
▪
Description of control and status word expanded
▪
Register description 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 | 1B | 01
1.1.0 | 1B | 01
1.0.0 | 1A | 00
The firmware and hardware versions (delivery state) can be found in the serial number printed on the side of the terminal.
Syntax of the serial number
Structure of the serial number: KK YY FF HH
KK - week of production (CW, calendar week)
YY - year of production
FF - firmware version
HH - hardware version
Example with ser. no.: 50 11 1A 00:
50 - week of production 50
11- year of production 2011
1A - firmware version 1A
00 - hardware version 00


Product overview

Product overview
Product overview
Additional information
•
Introduction
•
Technical data of the KL6781
•
LED displays


Introduction

Product overview [image] Introduction
Introduction
KL6781
The KL6781 M-bus master terminal enables direct connection of M-Bus devices. The M-bus (meter bus) is a fieldbus for consumption data acquisition from electricity, 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-bus master terminal.
The TwinCAT M-bus library enables operation without external M-bus gateway, i.e. the M-bus devices can be connected directly to the KL6781.
With a total line length of 300 m, up to 40 M-bus devices can be operated at a KL6781.


Technical data of the KL6781

Product overview [image] Technical data of the KL6781
Technical data of the KL6781
Technical Data | KL6781
Data transfer channels | 1
M-bus devices | max. 40
Transmission standard | M-bus properties
Data transfer rate | 300...9600 baud (default 2,400 baud)
Bus access | Master-slave technique (polling)
Cable length | max. 300 m
Current consumption from the K-bus | typically 65 mA
Current consumption from power contacts | max. 250 mA
Short-circuit strength | yes
Electrical isolation | 500 V (K-bus / M-bus)
Width in the 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 | on 35 mm mounting rail conforms to EN 60715
Permissible ambient temperature range during operation | 0 °C ... +55 °C
Permissible ambient temperature range during storage | -25 °C ... +85 °C
Permissible relative humidity | 95 %, no condensation
Vibration / shock resistance | conforms to EN 60068-2-6 / EN 60068-2-27 see also installation instructions for terminals with enhanced mechanical load capacity
EMC immunity / emission | conforms to EN 61000-6-2 / EN 61000-6-4
Protection class | IP20
Installation position | variable
Approval | CE, UL


LED displays

Product overview [image] LED displays
LED displays
LEDs
LED | Color | Meaning
Run | green | This 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 is signaled
Send | green | Data transmission on the M-bus
Receive | green | Data transmission on the M-bus


Mounting and wiring

Mounting and wiring
Mounting and wiring
Additional information
•
Installation on mounting rails
•
Installation instructions for enhanced mechanical load capacity
•
Connection


Installation on mounting rails

Mounting and wiring [image] Installation on mounting rails
Installation on mounting rails
WARNING
Risk of electric shock and damage of device!
Bring the bus terminal system into a safe, powered down state before starting installation, disassembly or wiring of the Bus Terminals!
Assembly
Attaching on mounting rail
The Bus Coupler and Bus Terminals are attached to commercially available 35 mm mounting rails (DIN rails according to EN 60715) by applying slight pressure:
1.
First attach the Fieldbus Coupler to the mounting rail.
2.
The Bus Terminals are now attached on the right-hand side of the Fieldbus Coupler. Join the components 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 rail first and then pushed together without tongue and groove, the connection will not be operational! When correctly assembled, no significant gap should be visible between the housings.
Note
Fixing of mounting rails
The locking mechanism of the terminals and couplers extends to the profile of the mounting rail. At the installation, the locking mechanism of the components must not come into conflict with the fixing bolts of the mounting rail. To mount the mounting rails with a height of 7.5 mm under the terminals and couplers, you should use flat mounting connections (e.g. countersunk screws or blind rivets).
Disassembly
Disassembling of terminal
Each terminal is secured by a lock on the mounting rail, which must be released for disassembly:
1.
Pull the terminal by its orange-colored lugs approximately 1 cm away from the mounting rail. In doing so for this terminal the mounting rail lock is released automatically and you can pull the terminal out of the bus terminal block easily without excessive force.
2.
Grasp the released terminal with thumb and index finger simultaneous at the upper and lower grooved housing surfaces and pull the terminal out of the bus terminal block.
Connections within a bus terminal block
The electric connections between the Bus Coupler and the Bus Terminals are automatically realized by joining the components:
▪
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 thus represent a supply rail within the bus terminal block. The power contacts are supplied via terminals on the Bus Coupler (up to 24 V) or for higher voltages via power feed terminals.
Note
Power Contacts
During the design of a bus terminal block, the pin assignment of the individual Bus Terminals must be taken account of, since some types (e.g. analog Bus Terminals or digital 4-channel Bus Terminals) do not or not fully loop through the power contacts. Power Feed Terminals (KL91xx, KL92xx or EL91xx, EL92xx) interrupt the power contacts and thus represent the start of a new supply rail.
PE power contact
The power contact labeled PE can be used as a protective earth. For safety reasons this contact mates first when plugging together, and can ground short-circuit currents of up to 125 A.
Power contact on left side
Attention
Possible damage of the device
Note that, for reasons of electromagnetic compatibility, the PE contacts are capacitatively coupled to the mounting rail. This may lead to incorrect results during insulation testing or to damage on the terminal (e.g. disruptive discharge to the PE line during insulation testing of a consumer with a nominal voltage of 230 V). For insulation testing, disconnect the PE supply line at the Bus Coupler or the Power Feed Terminal! In order to decouple further feed points 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 potentials!


Installation instructions for enhanced mechanical load capacity

Mounting and wiring [image] Installation instructions for enhanced mechanical load capacity
Installation instructions for enhanced mechanical load capacity
WARNING
Risk of injury through electric shock and damage to the device!
Bring the Bus Terminal system into a safe, de-energized state before starting mounting, disassembly or wiring of the Bus Terminals!
Additional checks
The terminals have undergone the following additional tests:
Verification | Explanation
Vibration | 10 frequency runs in 3 axes
 | 6 Hz < f < 60 Hz displacement 0.35 mm, constant amplitude
 | 60.1 Hz < f < 500 Hz acceleration 5 g, constant amplitude
Shocks | 1000 shocks in each direction, in 3 axes
 | 25 g, 6 ms
Additional installation instructions
For terminals with enhanced mechanical load capacity, the following additional installation instructions apply:
▪
The enhanced mechanical load capacity is valid for all permissible installation positions
▪
Use a mounting rail according to EN 60715 TH35-15
▪
Fix the terminal segment on both sides of the mounting rail with a mechanical fixture, e.g. an earth terminal or reinforced end clamp
▪
The maximum total extension of the terminal segment (without coupler) is:
64 terminals (12 mm mounting with) or 32 terminals (24 mm mounting with)
▪
Avoid deformation, twisting, crushing and bending of the mounting rail during edging and installation of the rail
▪
The mounting points of the mounting rail must be set at 5 cm intervals
▪
Use countersunk head screws to fasten the mounting rail
▪
The free length between the strain relief and the wire connection should be kept as short as possible. A distance of approx. 10 cm should be maintained to the cable duct.


Connection

Mounting and wiring [image] Connection
Connection
Additional information
•
Connection system
•
Wiring
•
Connection


Connection system

Mounting and wiring [image] Connection [image] Connection system
Connection system
WARNING
Risk of electric shock and damage of device!
Bring the bus terminal system into a safe, powered down state before starting installation, disassembly or wiring of the Bus Terminals!
Overview
The Bus Terminal system offers different connection options for optimum adaptation to the respective application:
▪
The terminals of ELxxxx and KLxxxx series with standard wiring include electronics and connection level in a single enclosure.
▪
The terminals of ESxxxx and KSxxxx series feature a pluggable connection level and enable steady wiring while replacing.
▪
The High Density Terminals (HD Terminals) include electronics and connection level in a single enclosure and have advanced packaging density.
Standard wiring (ELxxxx / KLxxxx)
Standard wiring
The terminals of ELxxxx and KLxxxx series have been tried and tested for years.
They feature integrated screwless spring force technology for fast and simple assembly.
Pluggable wiring (ESxxxx / KSxxxx)
Pluggable wiring
The terminals of ESxxxx and KSxxxx series feature a pluggable connection level.
The assembly and wiring procedure is the same as for the ELxxxx and KLxxxx series.
The pluggable connection level enables the complete wiring to be removed as a plug connector from the top of the housing for servicing.
The lower section can be removed from the terminal block by pulling the unlocking tab.
Insert the new component and plug in the connector with the wiring. This reduces the installation time and eliminates the risk of wires being mixed up.
The familiar dimensions of the terminal only had to be changed slightly. The new connector adds about 3 mm. The maximum height of the terminal remains unchanged.
A tab for strain relief of the cable simplifies assembly in many applications and prevents tangling of individual connection 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 product names for ESxxxx and KSxxxx series has been retained as known from ELxxxx and KLxxxx series.
High Density Terminals (HD Terminals)
High Density Terminals
The Bus Terminals from these series with 16 terminal points are distinguished by a particularly compact design, as the packaging density is twice as large as that of the standard 12 mm Bus Terminals. Massive conductors and conductors with a wire end sleeve can be inserted directly into the spring loaded terminal point without tools.
Note
Wiring HD Terminals
The High Density (HD) Terminals of the ELx8xx and KLx8xx series doesn't support pluggable wiring.
Ultrasonically "bonded" (ultrasonically welded) conductors
Note
Ultrasonically “bonded" conductors
It is also possible to connect the Standard and High Density Terminals with ultrasonically "bonded" (ultrasonically welded) conductors. In this case, please note the tables concerning the wire-size width below!


Wiring

Mounting and wiring [image] Connection [image] Wiring
Wiring
WARNING
Risk of electric shock and damage of device!
Bring the bus terminal system into a safe, powered down state before starting installation, disassembly or wiring of the Bus Terminals!
Terminals for standard wiring ELxxxx/KLxxxx and for pluggable wiring ESxxxx/KSxxxx
Connecting a cable on a terminal point
Up to eight terminal points enable the connection of solid or finely stranded cables to the Bus Terminal. The terminal points are implemented in spring force technology. Connect the cables as follows:
1.
Open a terminal point by pushing a screwdriver straight against the stop into the square opening above the terminal point. Do not turn the screwdriver or move it alternately (don'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 permanently.
See the following table for the suitable wire size width.
Terminal housing | ELxxxx, KLxxxx | ESxxxx, KSxxxx
Wire size width (single core wires) | 0.08 ... 2.5 mm2 | 0.08 ... 2.5 mm2
Wire size width (fine-wire conductors) | 0.08 ... 2.5 mm2 | 0,08 ... 2.5 mm2
Wire size width (conductors with a wire end sleeve) | 0.14 ... 1.5 mm2 | 0.14 ... 1.5 mm2
Wire stripping length | 8 ... 9 mm | 9 ... 10 mm
High Density Terminals (HD Terminals) with 16 terminal points
The conductors of the HD Terminals are connected without tools for single-wire conductors using the direct plug-in technique, i.e. after stripping the wire is simply plugged into the terminal point. The cables are released, as usual, using the contact release with the aid of a screwdriver. See the following table for the suitable wire size width.
Terminal housing | High Density Housing
Wire size width (single core wires) | 0.08 ... 1.5 mm2
Wire size width (fine-wire conductors) | 0.25 ... 1.5 mm2
Wire size width (conductors with a wire end sleeve) | 0.14 ... 0.75 mm2
Wire size width (ultrasonically “bonded" conductors) | only 1.5 mm2
Wire stripping length | 8 ... 9 mm


Connection

Mounting and wiring [image] Connection [image] Connection
Connection
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 connected to terminal point 7
4 | Shield | Shield connection, internally connected to terminal point 8
5 | reserved | -
6 | M-bus+ | M-bus plus, internally connected to terminal point 2
7 | M-bus- | M-bus minus, internally connected to terminal point 3
8 | Shield | Shield connection, internally connected to terminal point 4


Access from the user program

Access from the user program
Access from the user program
Additional information
•
Register Overview
•
Control and status word
•
Process image
•
Mapping
•
Register description
•
Examples of Register Communication


Register Overview

Access from the user program [image] Register Overview
Register Overview
The registers are used for parameterization the M-bus master terminal. They can be read or written by means of the register communication.
Register no. | Comment | Default value |  | R/W | Memory
R0 | Number of data bytes in the send buffer | variable | variable | R | RAM
R1 | Number of data bytes in the receive buffer | variable | variable | R | RAM
R2 | Number of parity errors | 0x0000 | 0dec | R | -
R3 | Number of framing errors | 0x0000 | 0dec | R | -
R4 | reserved | 0x0000 | 0dec | R | -
R5 | reserved | 0x0000 | 0dec | R | -
R6 | Diagnostic register | variable | variable | R | RAM
R7 | Command register | 0x0000 | 0dec | R/W | RAM
R8 | Terminal type | 0x1A7D | 6781dec | R | ROM
R9 | Firmware version | variable | variable | R | ROM
R10 | reserved | 0x0000 | 0dec | - | -
... | ... | ... | ... | ... | ...
R15 | reserved | 0x0000 | 0dec | - | -
R16 | Hardware version | e.g. 0x0000 | e.g.: 0dec | ... | EEPROM
R17 | reserved | 0x0000 | 0dec | - | -
... | ... | ... | ... | ... | ...
R18 | reserved | 0x0000 | 0dec | - | -
R29 | Terminal type - special identification | 0x0000 | 0dec | R | EEPROM
R30 | reserved | 0x0000 | 0dec | R/W | RAM
R31 | Code word register | 0x0000 | 0dec | R/W | RAM
R32 | Baud rate register | 0x0004 | 4dec | R/W | EEPROM
R33 | reserved | 0x0000 | 0dec | R/W | -
... | ... | ... | ... | ... | ...
R63 | reserved | 0x0000 | 0dec | R/W | -


Control and status word

Access from the user program [image] Control and status word
Control and status word
Process data mode
Control word (in process data mode)
The control word (CW) is located in the output process image, and is transmitted from the controller to the terminal.
Bit | CW.15 | CW.14 | CW.13 | CW.12 | CW.11 | CW.10 | CW.9 | CW.8 | CW.7 | CW.6 | CW.5 | CW.4 | CW.3 | CW.2 | CW.1 | CW.0
Name | OL7 | OL6 | OL5 | OL4 | OL3 | OL2 | OL1 | OL0 | Reg | - | - | - | - | IR | RA | TR
Key
Bit | Name | Description
CW.15 ... CW.8 | OL7 ... OL0 (OutLenght) | 1dec... 22dec | Number of output bytes () available for transfer from the controller to the terminal.
CW.7 | Reg (RegAccess) | 0bin | Register communication off (process data mode)
CW.6 ... CW.3 | - | 0bin | reserved
CW.2 | IR (InitRequest) | 0bin | The controller once again requests the terminal to prepare for serial data exchange.
 |  | 1bin | The controller requests terminal for initialization. The transmission and reception functions 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 (IA).
CW.1 | RA (ReceiveAccepted) | toggle | The controller acknowledges receipt of data by changing the state of this bit. Only then new data can be transferred from the terminal to the controller.
CW.0 | TR (TransmitRequest) | toggle | Via a change of state of this bit the controller notifies the terminal that the DataOut bytes contain the number of bytes indicated via the OL bits. The terminal acknowledges receipt of the data in the status byte via a change of state of bit SW.0 (TA). Only now new data can be transferred from the controller to the terminal.
Status word (in process data mode)
The status word (SW) is located in the input process image, and is transmitted from terminal to the controller.
Bit | SW.15 | SW.14 | SW.13 | SW.12 | SW.11 | SW.10 | SW.9 | SW.8 | SW.7 | SW.6 | SW.5 | SW.4 | SW.3 | SW.2 | SW.1 | SW.0
Name | IL7 | IL6 | IL5 | IL4 | IL3 | IL2 | IL1 | IL0 | Reg | - | - | - | BUF_F | IA | RR | TA
Key
Bit | Name | Description
SW.15 ... SW8 | IL7 ... IL0 (InLength) | 1dec ... 22dec | Number of input bytes available for transfer from the terminal to the controller.
SW.7 | Reg (RegAccess) | 0bin | Acknowledgment for process data mode
SW.6 ... SW.4 | - | 0 | reserved
SW.3 | BUF_F | 1bin | The reception FIFO is full. All further incoming data will be lost!
SW.2 | IA (InitAccepted bit) | 1bin | Initialization was completed by the terminal.
 |  | 0bin | The terminal is ready again for serial data exchange.
SW.1 | RR (ReceiveRequest) | toggle | Via a change of state of this bit the terminal notifies the controller that the DataIn bytes contain the number of bytes indicated via the IL bits. The controller has to acknowledge receipt of the data in the control byte via a change of state of bit CW.1 (RA). Only then new data can be transferred from the terminal to the controller.
SW.0 | TA (TransmitAccepted) | toggle | The terminal acknowledges receipt of data by changing the state 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 image, and is transmitted from the controller to the terminal.
Bit | CW.15 | CW.14 | CW.13 | CW.12 | CW.11 | CW.10 | CW.9 | CW.8 | CW.7 | CW.6 | CW.5 | CW.4 | CW.3 | CW.2 | CW.1 | CW.0
Name | RegData: |  |  |  |  |  |  |  | Reg | R/W | Reg. no.
Key
Bit | Name | Description
CW.15 ... CW.8 | RegData: | One byte of data to be written to the register. The other byte is transferred in the adjacent process data byte.
CW.7 | Reg | 1bin | Register communication switched on
CW.6 | R/W | 0bin | Read access
 |  | 1bin | Write access
CW.5 to CW.0 | Reg. no. | Register number: Enter the number of the register that you want to - read with the input data word DataIN and the HighByte of the status bytes (RegData) or - write the output data word DataOUT and the HighByte of control word (RegData).
Status byte (for register communication)
The status word (SW) is located in the input process image, and is transmitted from terminal to the controller.
Bit | SW.15 | SW.14 | SW.13 | SW.12 | SW.11 | SW.10 | SW.9 | SW.8 | SW.7 | SW.6 | SW.5 | SW.4 | SW.3 | SW.2 | SW.1 | SW.0
Name | RegData: |  |  |  |  |  |  |  | Reg | R/W | Reg. no.
Key
Bit | Name | Description
SW.15 ... SW.8 | RegData: | One byte of the data read from the register. The other byte is transferred in the adjacent process data byte.
SW.7 | RegAccess | 1bin | Acknowledgment for register access
SW.6 | R | 0bin | Read access
SW.5 to SW.0 | Reg. no. | Number of the register that was read or written.


Process image

Access from the user program [image] Process image
Process image
Note
No compact process image
The KL6781 cannot be operated 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 its complex process image, even if you set your Bus Coupler to a compact process image!
The KL6781 is represented in the process image with up to 24 bytes of input data and 24 bytes of output data.
Format | Input data | Output data
Word | SW | CW
Byte | DataIn0 | DataOut0
Byte | DataIn1 | DataOut1
... | ... | ...
Byte | DataIn21 | DataOut21
Key
SW: Status byte
CW: Control byte
DataIN 0 to DataIN 21: 22 bytes for the input data of the M-Bus
DataOUT 0 to DataOUT 21: 22 bytes for the output data of the M-Bus
▪
For the meaning of the control and status word please refer to the page Control and status word.
▪
Please refer to the Mapping page for the assignment of the bytes and words to the addresses of the controller.


Mapping

Access from the user program [image] Mapping
Mapping
The Bus Terminals occupy addresses within the process image of the controller. The assignment of process data (input and output data) and parameterization data (control and status bytes) to the control addresses is called mapping. The type of mapping depends on:
▪
the fieldbus system used
▪
the terminal type
▪
the parameterization of the Bus Coupler (conditions) such as
–
compact or complex evaluation
–
Intel or Motorola format
–
word alignment switched on or off
The following tables show the mapping depending on different conditions. For the content of the individual bytes please refer to pages Process image and Control and status word.
Compact evaluation
Note
No compact process image
The KL6781 cannot be operated 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 its complex process image, even if you set your Bus Coupler to a compact process image!
Complete evaluation
Complete evaluation in Intel format
 | Address | Input data |  | Output data
Conditions | Word offset | High byte | Low byte | High byte | Low byte
Complete evaluation: any Motorola format: no Word alignment: any | 0 | SW |  | CW
 | 1 | DataIN 1 | DataIN 0 | DataOUT 1 | DataOUT 0
 | 2 | DataIN 3 | DataIN 2 | DataOUT 3 | DataOUT 2
 | 3 | DataIN 5 | DataIN 4 | DataOUT 5 | DataOUT 4
 | 4 | DataIN 7 | DataIN 6 | DataOUT 7 | DataOUT 6
 | 5 | DataIN 9 | DataIN 8 | DataOUT 9 | DataOUT 8
 | 6 | DataIN 11 | DataIN 10 | DataOUT 11 | DataOUT 10
 | 7 | DataIN 13 | DataIN 12 | DataOUT 13 | DataOUT 12
 | 8 | DataIN 15 | DataIN 14 | DataOUT 15 | DataOUT 14
 | 9 | DataIN 17 | DataIN 16 | DataOUT 17 | DataOUT 16
 | 10 | DataIN 19 | DataIN 18 | DataOUT 19 | DataOUT 18
 | 11 | DataIN 21 | DataIN 20 | DataOUT 21 | DataOUT 20
Complex evaluation in Motorola format
 | Address | Input data |  | Output data
Conditions | Word offset | High byte | Low byte | High byte | Low byte
Complete evaluation: any Motorola format: yes Word alignment: any | 0 | SW |  | CW
 | 1 | DataIN 0 | DataIN 1 | DataOUT 0 | DataOUT 1
 | 2 | DataIN 2 | DataIN 3 | DataOUT 2 | DataOUT 3
 | 3 | DataIN 4 | DataIN 5 | DataOUT 4 | DataOUT 5
 | 4 | DataIN 6 | DataIN 7 | DataOUT 6 | DataOUT 7
 | 5 | DataIN 8 | DataIN 9 | DataOUT 8 | DataOUT 9
 | 6 | DataIN 10 | DataIN 11 | DataOUT 10 | DataOUT 11
 | 7 | DataIN 12 | DataIN 13 | DataOUT 12 | DataOUT 13
 | 8 | DataIN 14 | DataIN 15 | DataOUT 14 | DataOUT 15
 | 9 | DataIN 16 | DataIN 17 | DataOUT 16 | DataOUT 17
 | 10 | DataIN 18 | DataIN 19 | DataOUT 18 | DataOUT 19
 | 11 | DataIN 20 | DataIN 21 | DataOUT 20 | DataOUT 21


Register description

Access from the user program [image] Register description
Register description
The registers are used for parameterization the M-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: Number of data bytes in the receive buffer
Register R1 contains the number of data in the receive FIFO.
R6: Diagnostic register
Bit | R6.15 | R6.14 | R6.13 | R6.12 | R6.11 | R6.10 | R6.9 | R6.8
Name | - | - | - | - | - | - | - | -
Bit | R6.7 | R6.6 | R6.5 | R6.4 | R6.3 | R6.2 | R6.1 | R6.0
Name | - | - | - | BufferOverflow | Overrun | Framing error | Parity error | RxBufferOverflow
Key
Bit | Name | Description |  | default
R6.15…5 | - | - | reserved | -
R6.4 | BufferOverflow | 1bin | Buffer is full | 0bin
R6.3 | Overrun | 1bin | An overrun error has occurred | 0bin
R6.2 | Framing error | 1bin | A framing error has occurred | 0bin
R6.1 | Parity error | 1bin | A parity error has occurred | 0bin
R6.0 | RxBufferOverflow | 1bin | The receive buffer has overflowed, incoming data is lost. | 0bin
R7: Command register
The command register of the KL6781 is not used.
R8: Terminal type
The terminal name is contained in register R8:
KL6781: 0x1A7D (6781dec)
R9: Firmware version
Register R9 contains the ASCII coding of the terminal's firmware version, e.g. 0x3141 = '1A'. The '0x31' corresponds here to the ASCII character '1', while the '0x41' represents the ASCII character 'A'.
This value cannot be changed.
R16: Hardware version
Register R16 contains the hardware version of the terminal.
R29: Terminal type - special identification
The name of the special type of the terminal is contained in register R29. KL6781-0000: 0x0000 (0000dec)
R31: Code word register
▪
If you write values into the user registers without 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 user code word (0x1235) in the code word register, these values are stored in the RAM registers and in the SEEPROM registers and are therefore retained when the terminal is restarted.
The code word is reset when the terminal is restarted.
R32: Baud rate register
Bit | R32.15 | R32.14 | R32.13 | R32.12 | R32.11 | R32.10 | R32.9 | R32.8
Name | - | - | - | - | - | - | - | -
Bit | R32.7 | R32.6 | R32.5 | R32.4 | R32.3 | R32.2 | R32.1 | R32.0
Name | - | - | - | - | - | Baud rate
Key
Bit | Name | Description |  | default
R32.15 - R32.3 | - | reserved |  | 0bin
R32.2 - R32.0 | Baud rate | 110bin | 9600 baud | 100bin
 |  | 101bin | 4800 baud
 |  | 100bin | 2400 baud (default)
 |  | 11bin | 1200 baud
 |  | 010bin | 600 baud
 |  | 001bin | 300 baud


Examples of Register Communication

Access from the user program [image] Examples of Register Communication
Examples of Register Communication
The numbering of the bytes in the examples corresponds to the display without word alignment.
Additional information
•
Example 1: reading the firmware version from Register 9
•
Example 2: Writing to an user register


Example 1: reading the firmware version from Register 9

Access from the user program [image] Examples of Register Communication [image] Example 1: reading the firmware version from Register 9
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 1001bin) | 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 1001bin.
▪
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.


Example 2: Writing to an user register

Access from the user program [image] Examples of Register Communication [image] Example 2: Writing to an user register
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 1111bin) | 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 1111bin.
▪
The output data word (byte 1 and byte 2) contains the code word (0x1235) for deactivating write protection.
Input Data (answer of the bus terminal)
Byte 0: Status byte | Byte 1: DataIN1, high byte | Byte 2: DataIN1, low byte
0x9F (1001 1111bin) | 0xXX | 0xXX
Explanation:
▪
The terminal returns a value as a receipt in the status byte that differs only in bit 0.6 from the value of the control byte.
▪
The input data word (byte 1 and byte 2) is of no importance after the write access. Any values still displayed are invalid!
II. Read Register 31 (check the set code word)
Output Data
Byte 0: Control byte | Byte 1: DataOUT1, high byte | Byte 2: DataOUT1, low byte
0x9F (1001 1111bin) | 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 31 with 01 1111bin.
▪
The output data word (byte 1 and byte 2) has no meaning during read access.
Input Data (answer of the bus terminal)
Byte 0: Status byte | 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 current value of the code word register in the input data word (byte 1 and byte 2).
III. Write to Register 32 (change contents of the feature register)
Output data
Byte 0: Control byte | Byte 1: DataIN1, high byte | Byte 2: DataIN1, low byte
0xE0 (1110 0000bin) | 0x00 | 0x02
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 indicate register number 32 with 10 0000bin.
▪
The output data word (byte 1 and byte 2) contains the new value for the feature register.
CAUTION
Observe the register description!
The value of 0x0002 given here is just an example!
The bits of the feature register change the properties of the terminal and have a different meaning, depending on the type of terminal. Refer to the description of the feature register of your terminal (chapter Register description) regarding the meaning of the individual bits before changing the values.
Input data (response from the Bus Terminal)
Byte 0: Status byte | Byte 1: DataIN1, high byte | Byte 2: DataIN1, low byte
0xA0 (1010 0000bin) | 0xXX | 0xXX
Explanation:
▪
The terminal returns a value as a receipt in the status byte that differs only in bit 0.6 from the value of the control byte.
▪
The input data word (byte 1 and byte 2) is of no importance after the write access. Any values still displayed are invalid!
IV. Read Register 32 (check changed feature register)
Output Data
Byte 0: Control byte | Byte 1: DataOUT1, high byte | Byte 2: DataOUT1, low byte
0xA0 (1010 0000bin) | 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 indicate register number 32 with 10 0000bin.
▪
The output data word (byte 1 and byte 2) has no meaning during read access.
Input Data (answer of the bus terminal)
Byte 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 terminal returns the current value of the feature register in the input data word (byte 1 and byte 2).
V. Write Register 31 (reset code word)
Output Data
Byte 0: Control byte | Byte 1: DataOUT1, high byte | Byte 2: DataOUT1, low byte
0xDF (1101 1111bin) | 0x00 | 0x00
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 1111bin.
▪
The output data word (byte 1 and byte 2) contains 0x0000 for reactivating write protection.
Input Data (answer of the bus terminal)
Byte 0: Status byte | Byte 1: DataIN1, high byte | Byte 2: DataIN1, low byte
0x9F (1001 1111bin) | 0xXX | 0xXX
Explanation:
▪
The terminal returns a value as a receipt in the status byte that differs only in bit 0.6 from the value of the control byte.
▪
The input data word (byte 1 and byte 2) is of no importance after the write access. Any values still displayed are invalid!


M-bus

M-bus
M-bus
Additional information
•
Introduction
•
Overview
•
Topology


Introduction

M-bus [image] Introduction
Introduction
M-Bus = metering bus
The M-Bus is a fieldbus for the acquisition of consumption data (e.g. energy meters). Further details about M-Bus can be found under www.m-bus.com. The M-Bus is European standard and is described in the EN1434 standard. The data are sent serially from a slave (measuring device) to a master (level converter with PC). Master and slave are connected via a two-wire 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 manufacturers can be operated on the same bus.
The master controls the communication on the bus by requesting data from the slaves. The slaves can respond with a fixed or variable data structure. The M-Bus library only evaluates data with variable data structure (low byte first). The slaves do not communicate with each other. The data have to be requested sequentially from the slaves.


Overview

M-bus [image] Overview
Overview
KL6781 as M-bus master


Topology

M-bus [image] Topology
Topology
Star, line and tree topology
Star, line and tree topology
Ring topology
Ring topology
Note
Ring topology is not supported
Although ring topology is possible with the M-bus, it is not recommended and therefore not supported by Beckhoff.


Programming

Programming
Programming
Additional information
•
TwinCAT libraries


TwinCAT libraries

Programming [image] TwinCAT libraries
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


Appendix

Appendix
Appendix
Additional information
•
Support and Service


Support and Service

Appendix [image] Support and Service
Support and Service
Beckhoff and their partners around the world offer comprehensive support and service, making available fast and competent assistance with all questions related to Beckhoff products and system solutions.
Beckhoff's branch offices and representatives
Please contact your Beckhoff branch office or representative for local support and service on Beckhoff products!
The addresses of Beckhoff's branch offices and representatives round the world can be found on her internet pages:
http://www.beckhoff.com
You will also find further documentation for Beckhoff 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 offers you comprehensive technical assistance, helping you not only with the application of individual Beckhoff products, but also with other, wide-ranging services:
▪
support
▪
design, programming and commissioning of complex automation systems
▪
and extensive training program for Beckhoff system components
Hotline: | +49(0)5246/963-157
Fax: | +49(0)5246/963-9157
e-mail: | support@beckhoff.com
Beckhoff Service
The Beckhoff Service Center supports you in all matters of after-sales service:
▪
on-site service
▪
repair service
▪
spare parts service
▪
hotline service
Hotline: | +49(0)5246/963-460
Fax: | +49(0)5246/963-479
e-mail: | service@beckhoff.com