Receive data (MEWNET link)
This instruction receives data from another station through link units in the network.
Input
32-bit area for storing control data
Type of source operands for storing data in the target station. Be sure to select the area by setting the address 0 (e.g. DT0 or WR0, ...) (data area at the source station)
Starting 16-bit area address for the source operand specified in s2_AdrType (data area at the source station)
Starting 16-bit area address for storing data received (data area at the target station), must be a constant
The variables s2_AdrType, s2_AdrOffs and d_Start have to be of the same data type.
Specifications of s1_Control:
s1 higher byte |
s1 lower byte |
|
---|---|---|
1. Link No. selection (LK: 1–3, the station itself) |
1. Word unit send selection |
|
Up to 3 link units can be connected to 1 CPU. |
F = 0 |
Word unit selection |
n2 = 0 |
Set "0" when the word unit is selected |
|
This (LK) selects the source link unit of the three. |
n1 = 11–16 |
Specify the number of words to be sent |
2. Link station No. selection (UN: 1–63, another station) |
2. Bit unit send selection |
|
Up to 63 stations can be connected to 1 link unit. |
F = 1 |
Bit unit selection |
This (UN) then selects the target station No. |
n2 = 0–15 |
Destination bit No. |
n1 = 0–15 |
Source bit No. |
For detailed information, please refer to the relevant technical manual of the intelligent unit.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 8 ;
NETWORK_BODY
B(B_VARIN,,control_value,7,3,9,5,);
B(B_VARIN,,start_address,7,4,9,6,);
B(B_VARIN,,offset,7,5,9,7,);
B(B_VARIN,,output_value,7,6,9,8,);
B(B_CONTACT,,start,3,2,5,4,);
B(B_F,F146_RECV!,Instance,9,1,17,8,,?DEN?Ds1_Control?Ds2_AdrType?Ds2_AdrOffs?Dd_Start?AENO);
L(1,3,3,3);
L(5,3,9,3);
L(1,0,1,8);
END_NETWORK_BODY
END_NET_WORK
END_BODY
When the variable start is set to TRUE, the function is carried out.
VAR
start: BOOL:=FALSE;
(*activates the function*)
control_value: DWORD:=0;
(*32-bit area for storing
control data*)
start_address: WORD:=0;
(*Starting 16-bit area
address for the source
operand specified in s2*)
output_value: WORD:=0;
(*Starting 16-bit area
address for storing data
received*)
offset: INT:=0;
END_VAR
IF start then
F146_RECV( s1_Control:= control_value, s2_AdrType:= start_address, n_AdrOffs:= offset,
d_Start:= output_value);
END_IF;