# Example 2: Writing to an user register

 Code wordIn 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).

## 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!

## 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).

## 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!

## 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).

## 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!