Examples Of Register Communication; Example 1: Reading The Firmware Version From Register 9; Example 2: Writing To An User Register - Beckhoff KL2521 Series Documentation

One channel pulse train output terminals, rs422 / 24 v dc
Table of Contents

Advertisement

Access from the user program
Byte
Byte 3
Name
Data out, low byte
Value
0x35
The code word [} 32] is set, and the terminal returns the register address with bit 7 for register access as
acknowledgment.
Byte
Byte 3
Name
Data in, low byte
Value
0x00
5.5

Examples of Register Communication

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

Example 1: reading the firmware version from Register 9

Output Data
Byte 0: Control byte
0x89 (1000 1001
)
bin
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
• 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
0x89
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.
5.5.2

Example 2: Writing to an user register

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
Note
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).
38
Byte 2
Data out, high byte
0x12
Byte 2
Data in, high byte
0x00
Byte 1: DataOUT1, high byte
0xXX
Byte 1: DataIN1, high byte
0x33
Version: 2.1
Byte 1
Not used
0xXX
Byte 1
Not used
0x00
Byte 2: DataOUT1, low byte
0xXX
.
bin
Byte 2: DataIN1, low byte
0x41
Byte 0
Control byte
0xDF
Byte 0
Status byte
0x9F
KL2521

Advertisement

Table of Contents
loading

This manual is also suitable for:

Kl2521-0000Kl2521-0010Kl2521-0024

Table of Contents