Материал: m013802e_b

Внимание! Если размещение файла нарушает Ваши авторские права, то обязательно сообщите нам

5.3.1.10 Preset Multiple Registers (Function code 0x10):

This function writes values in a number of output words (also ”Output register”). With a broadcast transmission the values are written in all slaves. The maximum register number per frame is 128.

Inquiry:

яюэьыъщэш The first point is addressed with 0. The Modicon address starts with 1 (0x01).

The inquiry message determines the registers to be set. The data is sent as 2 bytes per register.

The example shows how data is set in the two registers 0 and 1 in slave 11:

Field name

Example

RTU

ASCII

 

Start of frame

-

t1-t2-t3

”:”

0x3a

Slave address

0x0B

0x0B

”0B”

0x30, 0x42

Function code

0x10

0x10

”10”

0x31, 0x30

Starting address high

0x00

0x00

”00”

0x30, 0x30

Starting address low

0x00

0x00

”00”

0x30, 0x30

Number of register high

0x00

0x00

”00”

0x30, 0x30

Number of register low

0x02

0x02

”02”

0x30, 0x32

Byte Counter

0x04

0x04

”04”

0x30, 0x34

Data high

(register 0)

0x12

0x12

”12”

0x31, 0x32

Data low

(register 0)

0x34

0x34

”34”

0x33, 0x34

Data high

(register 1)

0x56

0x56

”56”

0x35, 0x36

Data low

(register 1)

0x78

0x78

”78”

0x37, 0x38

Error Check (LRC / CRC)

-

0xA9

”CB”

0x43, 0x42

 

 

 

0x43

 

 

End of frame

 

t1-t2-t3

-

0xD, 0xA

Table 5.46: Example inquiry, Preset Multiple Registers

Reply:

The reply returns the slave address, the function code, the start address and the number of the set register.

Field name

Example

RTU

ASCII

 

Start of frame

-

t1-t2-t3

”:”

0x3a

Slave address

0x0B

0x0B

”0B”

0x30, 0x42

Function code

0x10

0x10

”10”

0x31, 0x30

Starting address high

0x00

0x00

”00”

0x30, 0x30

Starting address low

0x00

0x00

”00”

0x30, 0x30

Number of register high

0x00

0x00

”00”

0x30, 0x30

Number of register low

0x02

0x02

”02”

0x30, 0x32

Error Check (LRC / CRC)

-

0x41

”E3”

0x45, 0x33

 

 

0x62

 

 

End of frame

 

t1-t2-t3

-

0xD, 0xA

Table 5.47: Example reply, Preset Multiple Registers

MODBUS / Configuration

65

15.12.99

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5.3.2 Watchdog - Fieldbus failure

 

 

 

 

 

 

The watchdog serves for monitoring the data transfer between the higher ranking

 

яюэьыъщэш

 

 

 

controls and coupler/controller. For this the higher ranking controls cyclically actuate a

 

 

 

 

 

 

 

 

 

 

 

 

time function (Time-out) in the coupler/controller. In the case of fault free

 

 

 

 

 

 

communication this time cannot reach its end value, because prior to this it is restarted

 

 

 

 

 

 

again and again. If this time has elapsed a fieldbus failure has occurred.

 

 

 

 

 

 

The watchdog must be switched on so that it can be activated (see ‘coupler/settings’ or

 

 

 

 

 

 

‘Controller/settings’).

 

 

 

 

 

 

In the coupler/controller special registers are present for the selection and status inquiry

 

 

 

 

 

 

of the watchdog by the higher ranking controls (Register addresses 0x1000 to 0x1008).

 

 

 

 

 

 

After switching on the supply voltage the watchdog is not yet activated. First lay down

 

 

 

 

 

 

the time-out value (Register 0x1000). The watchdog can be activated by writing a

 

 

 

 

 

 

function code in the mask register (0x1001), which is unequal 0. A second activation

 

 

 

 

 

 

possibility is to write a value in the toggle register (0x1003) deviating from 0.

 

 

 

 

 

 

Reading the minimum trigger time (Register 0x1004) reveals whether the watchdog

 

 

 

 

 

 

fault reaction was activated. If this time value is 0, a fieldbus failure is assumed. The

 

 

 

 

 

 

watchdog can be restarted in accordance with the previously mentioned two possibilities

 

 

 

 

 

 

or using the register 0x1007.

If the watchdog is started once it can only be stopped by the user for safety reasons via a certain path (register 0x1005 or 0x1008).

66

MODBUS / Configuration

15.12.99

Watchdog register:

The table below shows the registers for the Watchdog/Supervisor function.

 

Register

Designation

Access

Length

Default

Description

 

 

 

 

 

address

 

 

 

 

 

 

 

(word)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

0 x 1000

Watchdog/

read/

1

pu/co

This register saves the value for time exceeded

 

 

Supervisor

write

 

0x0000

(Time-out). To be able to start the watchdog default

 

 

time

 

 

 

value must have a value which is not equal to zero.

 

 

WD_TIME

 

 

 

The time is set as a multiple of 100 ms, 0x0009

 

 

 

 

 

 

means a time out time of 0.9 s. This value cannot be

 

 

 

 

 

 

changed when the watchdog is running.

 

 

 

 

 

 

 

 

 

0 x 1001

Watchdog/

read/

1

pu/co

Using this mask the function codes can be set to

 

 

Supervisor

write

 

0x0000

trigger the watchdog function. The function code can

 

 

Coding mask,

 

 

 

be

selected

via

a

‘1’

to

 

 

Function code 1...16,

 

 

 

( = 2(Function code-1)+ ....)

 

 

 

 

 

 

WDFCM_1_16

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Bit 1001.0 corresponds to function code1,

 

 

 

 

 

 

 

Bit 1001.1 corresponds to function code2...

 

 

 

 

 

 

 

The watchdog function is started if a value is not

 

 

 

 

 

 

equal to zero. If only codes from non-supported

 

 

 

 

 

 

functions are entered in the mask the watchdog will

 

 

 

 

 

 

not start. An existing fault is reset and writing into the

 

 

 

 

 

 

process illustration is possible. Also here changes

 

 

 

 

 

 

cannot be made while the watchdog is running.

 

 

 

 

 

 

 

 

 

 

0 x 1002

Watchdog function

read/

1

pu/co

Same function as above, however,

with the function

 

 

Coding mask,

write

 

0x0000

codes 17 to 32. These codes are not supported, for

 

 

Function code

 

 

 

this reason the default value of this register should

 

 

17...32,

 

 

 

not be changed. It is not possible do modify this value

 

 

WD_FCM_17_32

 

 

 

while the watchdog is running.

 

 

 

 

 

 

 

 

 

 

 

0 x 1003

Watchdog trigger,

read/

1

pu/co

This register is used for an alternative trigger method.

 

 

WD_TRIGGER

write

 

0x0000

The watchdog is triggered by writing different values

 

 

 

 

 

 

in this register. Values following each other must

 

 

 

 

 

 

differ in size. Writing of a value not equal to zero

 

 

 

 

 

 

starts the watchdog. In case of a watchdog fault this

 

 

 

 

 

 

register is reset to zero.

 

 

 

 

 

 

 

 

 

 

 

 

0 x 1004

Minimal actual trigger

read/

1

pu/co

Using this value the current watchdog status can be

 

 

time,

write

 

0xFFFF

read. If the watchdog is triggered the saved value is

 

 

WD_AC_TRG_TIME

 

 

 

compared with the current value. If the current value

 

 

 

 

 

 

is smaller than the saved value this is replaced by the

 

 

 

 

 

 

current value. The unit is 100 ms/digit. The saved

 

 

 

 

 

 

value is changed by writing new values, which does

 

 

 

 

 

 

not affect the watchdog. 0x000 is not permissible.

 

 

 

 

 

 

 

 

 

0 x 1005

Stop watchdog,

read/

1

pu/co

The watchdog is stopped if here the value 0xAAAA is

 

 

WD_AC_STOP_MASK

write

 

0x0000

written first, followed by 0x5555. The watchdog fault

 

 

 

 

 

 

reaction is blocked. A watchdog fault is reset and

 

 

 

 

 

 

writing on the process data is possible again.

 

 

 

 

 

 

 

 

 

 

 

 

0 x 1006

When watchdog is

read

1

pu

Current watchdog status.

 

 

 

 

 

running,

 

 

0x0000

at 0x0: Watchdog not active,

 

 

 

 

 

WD_RUNNING

 

 

 

at 0x1: Watchdog active.

 

 

 

 

 

 

 

 

 

 

 

 

0 x 1007

Restart watchdog,

read/

1

pu

Writing 0x1 into the register starts the watchdog

 

 

WD_RESTART

write

 

0x001

again.

 

 

 

 

 

 

 

 

 

 

 

 

 

0 x 1008

Simplified watchdog

Read/

1

pu

The watchdog is stopped by writing the value

 

 

stop

write

 

0x0000

0x0AA55 or 0X55AA (as from V2.5), if it was already

 

 

WD_AC_STOP_SIMPLE

 

 

 

active. The watchdog fault reaction is deactivated. An

 

 

 

 

 

 

existing watchdog fault is reset and it is possible to

 

 

 

 

 

 

write in the watchdog register again.

 

 

 

 

 

 

 

 

 

 

 

Table 5.48: Watchdog-Register

 

 

 

 

pu: Default value when switching voltage on

 

 

 

 

 

 

 

co: constant value ROM located

 

MODBUS / Configuration

 

67

 

 

 

 

 

 

 

15.12.99

In all registers the length is 1, i.e. with each access only one word can be written or read.

Examples:

Setting the watchdog for a time overrun of more than 1 s:

1.Write 0x000A (=1000 ms / 100 ms) in the register for time overrun (0x1000).

2.Write 0x0010 (=2(5-1)) in the coding mask (register 0x1001) to start the watchdog.

3.Use the function ‘Force Single Coil’ to trigger the watchdog.

4.Read the register of the minimum current trigger time and compare this with zero to check whether a time overrun has occurred.

Repeat step 3 and Step 4.

Setting a watchdog a time overrun of more than 10 min:

1.Write 0x1770 (=10*60*1000 ms / 100 ms) in the register for time overrun (0x1000).

2.Write 0x0001 in the watchdog trigger register (0x1003) to start the watchdog.

3.Write 0x0001, 0x0000, 0x0001... or a counter value in the watchdog trigger register (0x1003) to trigger the watchdog.

4.Read the register of the minimum current trigger time and compare it with zero to check if a time overrun has occurred.

Repeat step 3 and Step 4.

68

MODBUS / Configuration

15.12.99

Fieldbus failure on the coupler:

The evaluation of the watchdog register is made by the coupler firmware. The internal bus is interrupted. The digital outputs are set to 0 and the analog outputs are set to the minimum value (e.g. with 4...20 mA to 4 mA).

Fieldbus failure on controller:

The evaluation of the watchdog register is made using the function block ‘FBUS_ERROR_INFORMATION’ in the control program. The internal bus remains in function and the process illustrations are retained. The control program can be further processed independently.

Fig. 5.15:Function block for determining a fieldbus failure

FBUS_ERROR’ (BOOL)

= FALSE = no fault

 

= TRUE = fieldbus failure

‘ERROR’ (WORD)

= 0 = no fault

 

= 1 = fieldbus failure

The nodes can set to a safe status in the case of a fieldbus failure using these outputs and a corresponding control program.

MODBUS / Configuration

69

15.12.99