Example of register communication

(For examples of register communication via SDO, see the object directory, object 0x4501)

If bit 7 of the control byte is set, then the first two bytes of the user data are not used for exchanging process data, but are written into or read from the terminal's register set.
Bit 6 of the control byte specifies whether a register should be read or written. If bit 6 is not set, then a register is read out without modifying it. The value can then be taken from the input process image.
If bit 6 is set, then the user data is written into a register. As soon as the status byte has supplied an acknowledgement in the input process image, the procedure is completed (see example).
The address of the register that is to be addressed is entered into bits 0 to 5 of the control byte.

REG=1

W/R

A5

A4

A3

A2

A1

A0

REG: Register bit
REG = 0: Process data
REG = 1: Register communication

R/W: Access to register structure
W/R = 0: Read register
W/R = 1: Write register

A5..A0: Register address
Altogether 64 registers may be addressed through A5...A0

Example 1

Reading register 8 from an IP/IE1502. The module contains two channels, each of which is mapped with 5 bytes into the process image.

Byte 0 (control byte)

Byte 1 (data in, D0)

Byte 2 (data in, D1)

Byte 3 (data in, D2)

Byte 5 (data in, D3)

0x88

0xXX

0xXX

0xXX

0xXX

Bit 0.7 and bit 0.3 are set. This means that register communication is active, but only for reading because bit 0.6 is low. Register 8 is indicated for reading. When access is only for reading, the output data word has no significance. If we want to change a register, then the desired setting is written into the output word.

The box returns the following type identification (0x05DE corresponds to unsigned integer 1502).
Special features of Fieldbus Boxes:

The last figure does not indicate the connection type (0 for S8, 1 for M8 and 2 for M12), but returns the number of channels.

Byte 0 (status byte)

Byte 1 (data in, D0)

Byte 2 (data in, D1)

Byte 3 (data in, D2)

Byte 5 (data in, D3)

0x88

0x00

0x00

0x05

0xDE

Note

In order to write into registers, the password (0x1235) must be written into register 31, so that write protection is deactivated. It is activated 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.

Example 2

Process of register communication for writing into register

1. Write register 31

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xDF

0x12

0x35

Answer from the module/Bus Terminal

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0x9F

0x00

0x00

 

2. Read register 31

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0x9F

0xXX

0xXX

Answer from the module/Bus Terminal

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0x9F

0x12

0x35

 

3. Write register 32

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xE0

0x00

0x02

Answer from the module/Bus Terminal

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xA0

0x00

0x00

 

4. Read register 32

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xA0

0xXX

0xXX

Answer from the module/Bus Terminal

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xA0

0x00

0x02

 

5. Write register 31, reset code word

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0xDF

0x00

0x00

Answer from the module/Bus Terminal

Byte 0 (control byte)

Byte 1 (data in, high byte)

Byte 2 (data in, low byte)

0x9F

0x00

0x00