Function
description:
Management of the 4 blocks MBP_MSTR for interrogation
of 128 devices with different frequency of interrogation
Symbol:
____________________
| |
| CTRL_MBP
|
| |
aUINT_1x4 ---| MBP_ND------MBP_ND |--- aUINT_1x4
aMB_Var_1x128 ---| MBP_Var----MBP_Var |--- aMB_Var_1x128
aMBP_Data_1x4 ---| MBP_Data--MBP_Data |--- aMBP_Data_1x4
aWORD_1x4_1x125
---| MBP_D_Bf--MBP_D_Bf |--- aWORD_1x4_1x125
aBOOL_1x4 ---| MBP_Act MBP_Enbl
|--- aBOOL_1x4
aBOOL_1x4 ---| MBP_Err MBP_Abrt
|--- aBOOL_1x4
aBOOL_1x4 ---| MBP_Suc dMBP_Err
|--- aWORD_1x128
aMBP_Master_1x128 ---| dMBP_Par |
UINT ---| Dev_Num
|
BOOL ---| Abort
|
UINT ---| MBP_Lvl
|
|____________________|
Parameter
description:
Description of the
block parameters:
Parameter Data type Meaning
MBP_ND aUINT_1x4 Number of the device for paths 1..4,
interrogated at the given moment
MBP_Var aMB_Var_1x128 Intermediate meanings
MBP_Data aMBP_Data_1x4 Intermediate meanings of output
"CONTROL" for MBP_MSTR 1..4
MBP_D_Bf aWORD_1x4_1x125 Intermediate meanings of output
"DATABUF" for MBP_MSTR 1..4
MBP_Act aBOOL_1x4 Operation is active from a MBP_MSTR
1..4
MBP_Err aBOOL_1x4 Faulty operation from a MBP_MSTR 1..4
MBP_Suc aBOOL_1x4 Operation completed sucssesfully from a
MBP_MSTR 1..4
dMBP_Par aMBP_Master_1x128 Parameters of interrogation of devices 1..128
Dev_Num UINT Quantity of devices in a network
Abort BOOL To interrupt interrogation
MBP_Lvl UINT Interdiction of simultaneous
interrogation of devices at concurrence of routing path on the given quantity
of elements
MBP_Enbl aBOOL_1x4 Enable MSTR function for MBP_MSTR 1..4
MBP_Abrt aBOOL_1x4 Cancel active MSTR operation for
MBP_MSTR 1..4
dMBP_Err aWORD_1x128 Error status for devices 1..4
Structure sMB_Variable.
|
Element of structure |
Type |
Description |
|
Stat |
WORD |
Bit
0 = 1 - goes interrogation; Bit
1 = 1 - on the given cycle of scanning inquiry was finished without a
mistake; Bit
2 = 1 - on the given cycle of scanning inquiry was finished with a mistake; Bit
3 = 1 - last inquiry was finished without a mistake; Bit
4 = 1 - last inquiry was finished with a mistake. |
|
Prior |
UINT |
The
priority of interrogation (0 - is not interrogated or there is an
interrogation, 1 - lowest, 65535 - maximum) |
Structure sMBP_Master.
|
Element of structure |
Type |
Description |
|
Funct |
BYTE |
Bits
6..0 (LSB) - function: 1
- Write data; 2
- Read data; 3
- Get local statistics; 4
- Clear local statistics; 5
- Write global data; 6
- Read global data; 7
- Get remote statistics; 8
- Clear remote statistics; 9
- Peer Cop Status (Peer Cop
Health). Bit
7 (MSB): 0
- Read data to 4õ registers; 1
- Read data to 3õ registers (for functions 2, 3, 6, 7, 9 only). |
|
Len |
BYTE |
Number
of registers transferred |
|
RR[1] |
BYTE |
Routing
register 1 |
|
RR[2] |
BYTE |
Routing
register 2 |
|
RR[3] |
BYTE |
Routing
register 3 |
|
RR[4] |
BYTE |
Routing
register 4 |
|
RR[5] |
BYTE |
Routing
register 5 |
|
NumSlot |
BYTE |
Slot
1 to 16 of the NOE module. (0 if use CPU MB+ port) |
|
FunArg |
WORD |
Indicates
MSTR operation-dependent information: Funct
= 1 - Determines the 4x starting register in the slave to which the data must
be written (e.g. 1 = 40001, 49=40049); Funct
= 2 – Determines the 4x starting register in the slave from which the data
must be read (e.g. 1 = 40001, 49 = 40049); Funct
= 3 – First register from which the statistics table must be read (Reg1=0); Funct
= 4, 5, 6 – Reserved; Funct
= 7 – First register from which the node statistics must be read. The number
of available statistics registers may not be exceeded. Funct
= 8 – Reserved; Funct
= 9 - First word to be
read from the peer cop table (0...11; 0=first word in peer cop table and
11=last word in peer cop table) |
|
Addr |
UINT |
First
4x or 3x register of the data field |
|
Prior_Beg |
UINT |
The
priority of interrogation exposed after download or end of interrogation of
device (0 - is not interrogated, 1 - lowest, 65535 - maximum) |
|
PriorAdd_Ok |
UINT |
Meaning,
by which the priority of interrogation is increased everyone 10ms, if the
interrogation has taken place without a mistake |
|
PriorAdd_Err |
UINT |
Meaning,
by which the priority of interrogation is increased everyone 10ms, if the
interrogation has taken place with a mistake |
Detailed
description:
It is consistently possible to interrogate up to 128
devices in a network Modbus+ with
various frequency on the 4 paths. The quantity of devices is stored in input
Dev_Num.
For interrogation of devices the following algorithm
is carried out:
1. In a cycle
all devices get over and the device with the maximal priority is searched (if
them it is a some, the device with a smaller serial number) gets out.
2. If the
priority is not equal 0, the inquiry about the given device is given out.
3. After ending
interrogation byte of the status and code of a mistake is filled.
4. For the
interrogated device the given priority is exposed.
Algorithm of definition of priorities in parallel
works:
1. For all
devices, which are required to be interrogated and which interrogation at the
given moment is not carried out, through everyone 10ms the priority is
increased by the given meaning.