Function
description:
Management of the block XXMIT for interrogation of ten
devices with different frequency of interrogation
Symbol:
____________________
| |
| CNTRL_XM |
| |
BOOL ---| Abort LstPErr |--- BOOL
BOOL ---| X_Activ LstPErrD |---
UINT
INT ---| X_Err LstPErrC |---
WORD
| Err_Cd
|--- aWORD_1x10
UINT ---| iDvNmPol oDvNmPol
|--- UINT
aMB_Var_1x10 ---| iVar oVar |---
aMB_Var_1x10
aUINT_1x10 ---| iOK_Cnt oOK_Cnt |---
aUINT_1x10
aUINT_1x10 ---| iErr_Cnt
oErr_Cnt |---
aUINT_1x10
| X_Start
|--- BOOL
UINT ---| Dev_Num X_Cmnd |---
WORD
aMB_Cnst_1x10 ---| Cnst X_MsgOut |---
aWORD_1x10
aMB_XXMIT_1x10
---| XXMIT_PR X_MsgLen |--- INT
| X_Port
|--- BYTE
| X_BR |--- INT
| X_DB |---
BYTE
| X_StpB
|--- BYTE
| X_Parity
|--- BYTE
| X_RespT
|--- INT
| X_RtrLmt
|--- INT
| X_StrtD
|--- INT
| X_EndDly
|--- INT
|____________________|
Parameter
description:
Description of the
block parameters:
Parameter Data type Meaning
Abort BOOL To
interrupt interrogation
X_Activ BOOL The
Block XXMIT is active
X_Err INT Code of a mistake from the block
XXMIT
iDvNmPol UINT Number of the device, interrogated
at the given moment
iVar aMB_Var_1x10 The Variable information
iOK_Cnt aUINT_1x10 The Counter of successful transfers of
the information
iErr_Cnt aUINT_1x10 Counter of unsuccessful transfers of the
information
Dev_Num UINT Quantity of devices in a network
Cnst aMB_Cnst_1x10 The Constant information on devices
XXMIT_PR aMB_XXMIT_1x10
Parameters of devices for the block
XXMIT
LstPErr BOOL Last interrogation was finished
with a mistake
LstPErrD UINT Number of the device, for which
the interrogation was finished with a mistake
LstPErrC WORD A
Code of last mistake
Err_Cd aWORD_1x10 Codes of mistakes
oDvNmPol UINT Number of the device, interrogated
at the given moment
oVar aMB_Var_1x10 The Variable information
oOK_Cnt aUINT_1x10 The Counter of successful transfers of
the information
oErr_Cnt aUINT_1x10 The Counter of unsuccessful transfers of
the information
X_Start BOOL Start of the block XXMIT
X_Cmnd WORD Parameter for the block XXMIT
X_MsgOut aWORD_1x10 Parameter for the block XXMIT
X_MsgLen INT Parameter for the block XXMIT
X_Port BYTE Parameter for the block XXMIT
X_BR INT Parameter for the block XXMIT
X_DB BYTE Parameter for the block XXMIT
X_StpB BYTE Parameter for the block XXMIT
X_Parity BYTE Parameter for the block XXMIT
X_RespT INT Parameter for the block XXMIT
X_RtrLmt INT Parameter for the block XXMIT
X_StrtD INT Parameter for the block XXMIT
X_EndDly INT Parameter for the block XXMIT
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 sMB_Constant.
|
Element of structure |
Type |
Description |
|
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 |
Structure sMB_XXMIT_par.
|
Element of structure |
Type |
Description |
|
Command |
WORD |
The
carried out command (is usual 0100h for Modbus) |
|
MsgLen |
INT |
Length
of the message (is usual 5) |
|
Baudrate |
INT |
Baudrate. Gets out of a line 50,
75, 110, 134, 150, 300, 600, 1200, 1800, 2000, 2400, 3600, 4800, 7200, 9600,
19200 |
|
Port |
BYTE |
Number
of port (1 - for 1-st port CPU. The port 2 is
accessible only for Momentum) |
|
Databits |
BYTE |
Quantity
bit of the data. For a mode ASCII 7, for a mode RTU 8 (it is usual 8) |
|
Stopbits |
BYTE |
Quantity
of stop - bit: 1 or 2. (it is usual 1) |
|
Parity |
BYTE |
The
control of parity (is usual 2): 0
- there is no control; 1
- odd; 2 - even. |
|
RespTour |
INT |
The
waiting time of the correct answer, ms |
|
RetryLmt |
INT |
The
number of repeated attempts before reception of the correct answer |
|
StartDly |
INT |
The
idle time before transfer of the message, ms |
|
EndDly |
INT |
The
idle time after transfer of the message, ms |
|
MsgOut[1] |
WORD |
Carried
out function: 1
- to read the registers such as 0x from slave; 2
- to read the registers such as 1x from slave (in area 0õ); 3
- to read the registers such as 4x from slave; 4
- to read the registers such as 3x from slave (in area 4õ); 5
- to write down the one register 0õ in slave; 6
- to write down the one register 4õ in slave; 15
- to write down the registers 0õ in slave; 16
- to write down the registers 4õ in slave. |
|
MsgOut[2] |
WORD |
Quantity
of the read or write registers |
|
MsgOut[3] |
WORD |
The
address of the device slave in a network |
|
MsgOut[4] |
WORD |
The
address of memory of the device slave, whence to read (or where to write) the
data |
|
MsgOut[5] |
WORD |
The
address of memory of the controller where to write (or whence to read) the
data |
Detailed
description:
It is consistently possible to interrogate up to 10
devices in a network Modbus with various frequency. 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.