Read data from the slave station
This instruction reads data from the specified intelligent unit of the MEWNET-F slave station.
Input
Stores control data for master/slave configuration
Starting address of the memory area to be read
Number of words to be read (max. 32 words)
Starting 16-bit area where words read are stored, (see F153)
The variables s2_Start and d_Start have to be of the same data type.
It is not possible to execute multiple F152_RMRD instructions and F153_RMWT instructions at the same time. The program should be set up so that these instructions are executed when the F152_RMRD/F153_RMWT instruction execution enabled flag sys_bIsMewnetFNotActive is TRUE.
sys_bIsMewnetFNotActive | 0: Execution inhibited (F152_RMRD/F153_RMWT instruction being executed) 1: Execution enabled |
The F152_RMRD instruction only enables a request to be accepted. The actual processing is carried out at the end of the scan. The F152_RMRD/F153_RMWT instruction completed flag (R9036) can be used to confirm whether or not the instruction has been executed.
sys_bIsMewnetFError | 0: Normal completion 1: Completed with error (the error code is stored in sys_wMewnetFErrorCode) |
sys_wMewnetFErrorCode | If the transmission has been completed with an error (sys_bIsMewnetFError (turns to TRUE and remains TRUE) , the contents of the error (error code) are stored. |
Error code (HEX) |
Description |
---|---|
16#5B |
Timeout error (no intelligent unit found at the specified location) |
16#68 |
No memory error (no memory exists at the specified address) |
16#71 |
Send answer timeout error |
16#72 |
Send buffer full timeout error |
16#73 |
Response timeout error |
If the error code is 16#71–16#73, a communication timeout error has occurred. The timeout time can be changed within a range of 10.0ms to 81.9s (in units of 10ms), using the setting of system register 32. The default value is set to 2 seconds.
s1 stores the control data for the configuration of the master and slave units in the network. n words are read beginning from the shared memory address number in the intelligent unit specified by s2_Start. The result is stored in d.
Specifications of s1_Control:
Intelligent unit with bank: FP3 expansion data memory unit
Order number: AFP32091 AFP32092
if the control data s1_Control exceeds the limit of specified range
if no MEWNET-F master unit is found
if the data read exceeds the area of s2_Start
if the control data s1_Control exceeds the limit of specified range
if no MEWNET-F master unit is found
if the data read exceeds the area of s2_Start
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.
VAR
Start: BOOL:=FALSE;
ControlData: DWORD:=16#000A0105;
(*No bank,
slot no. 10,
Master station 1,
Slave station 5*)
StartingAddress: WORD:=0;
NoWordsWrite: INT:=5;
WordsWritten: ARRAY [0..4] OF WORD:=[5(0)];
END_VAR
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_F,F152_RMRD,,11,1,20,8,,?DEN?D@'s1'?Ds2?Dn?Dd?AENO);
B(B_CONTACT,,Start,5,1,7,3,);
B(B_VARIN,,ControlData,9,3,11,5,);
B(B_VARIN,,StartingAddSlave,9,4,11,6,);
B(B_VARIN,,NumberWordsRead,9,5,11,7,);
B(B_VARIN,,WordsRead[0],9,6,11,8,);
L(1,0,1,8);
L(1,2,5,2);
L(7,2,11,2);
L(11,2,11,3);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If (Start) Then
F152_RMRD(s1_Control := ControlData,
s2_Start := StartingAddress,
n_Number := NoWordsWrite,
d_Start := WordsRead[0]);
End_if;