Example 2: Writing To An User Register - Beckhoff KL403 Series Documentation

Single-, dual- and four-channel analog output terminals, signal range: -10 v to +10 v
Table of Contents

Advertisement

Access from the user program
◦ ASCII code 0x41 represents the letter A
The firmware version is thus 3A.
5.6.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 deacti-
vate 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
0xDF (1101 1111
)
bin
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
• 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
0x9F (1001 1111
)
bin
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
0x9F (1001 1111
)
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 31 with 01 1111
• 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
0x9F (1001 1111
)
bin
42
Byte 1: DataOUT1, high byte
0x12
Byte 1: DataIN1, high byte
0xXX
Byte 1: DataOUT1, high byte
0xXX
Byte 1: DataIN1, high byte
0x12
Version: 4.1
Byte 2: DataOUT1, low byte
0x35
.
bin
Byte 2: DataIN1, low byte
0xXX
Byte 2: DataOUT1, low byte
0xXX
.
bin
Byte 2: DataIN1, low byte
0x35
KL403x

Advertisement

Table of Contents
loading

This manual is also suitable for:

Kl4031Kl4032Kl4034

Table of Contents