5 examples of register communication, Register communication – BECKHOFF KL3681 User Manual
Page 38

Access from the user programm
R32 to R35: Internal calibration data
These registers contain internal calibration data and must not be changed by the user!
R36 to R63: Manufacturer calibration
These registers are used for manufacturer calibration and must not be changed by the user!
5.5
Examples of Register Communication
In the examples, the numbering of the bytes is according to the description without WordAlignment.
Example 1: Reading the Firmware Issue Status from Register 9 of a Terminal
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 indicates register communication active.
• Bit 0.6 not set indicates reading the register.
• Bit 0.5 to Bit 0.0 indicates with 00 1001
bin
the register number 9.
• The output data word (Byte 1 and Byte 2) has no function at the reading access. If you want to change
a register, you have to write the desired value into the output data word.
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 in the Status Byte, as an acknowledgement.
• The terminal returns the Firmware Issue Status 0x3341 in ASCII code, in the input data word (Byte 1
and Byte 2). This has to be interpreted as ASCII code:
ASCII code 0x33 stands for the cipher 3
ASCII code 0x41 stands for the letter A
Therefore the firmware version is 3A.
Example 2: Writing to an user register
Note
Code word
At normal operation all user registers other than register 31are write protected. In order to
deactivate write protection, you have to write the password (0x1235) into register 31. Write
protection is activated again by writing any value other than 0x1235 Note that some of the
settings that can be made in registers only become active after the next power restart
(poweroff/poweron) of the terminal.
I. Writing the code word (0x1235) to Register 31
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 indicates: register communication active.
• Bit 0.6 set indicates: writing to the register.
• Bit 0.5 to Bit 0.0 indicates with 01 1111
bin
the register number 31.
KL3681, KS3681
38
Version 2.0.0