F152_RMRD

Read data from the slave station

This instruction reads data from the specified intelligent unit of the MEWNET-F slave station.

Parameters

Input

s1_Control (DWORD)

Stores control data for master/slave configuration

s2_Start (WORD, INT, UINT)

Starting address of the memory area to be read

n_Number (INT)

Number of words to be read (max. 32 words)

d_Start (WORD, INT, UINT)

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.

Remarks

  • 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:

    1.  (1) s1 higher word
    2.  (2) Bit
    3.  (3) s1 higher word
    4.  (4) Bank No. (16#0016#FF if there is a bank to specify, otherwise 16#00)
    5.  (5) Slot No. (16#0016#1F, FP3: 16#0016#17)
    6.  (6) s1 lower word
    7.  (7) s1 lower word
    8.  (8) Master station No.(16#0116#04)
    9.  (9) Slave station No. (16#0116#20)
Tip

Intelligent unit with bank: FP3 expansion data memory unit

Order number: AFP32091 AFP32092

Error flags

sys_bIsOperationErrorHold
  • 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

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • 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

Example

POU header

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.

  1.  (1) Master station 1
  2.  (2) Control data = 16#A0105
  3.  (3) Intelligent unit (shared memory)
	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

LD body

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

ST body

If (Start) Then
    F152_RMRD(s1_Control := ControlData,
              s2_Start := StartingAddress,
              n_Number := NoWordsWrite,
              d_Start := WordsRead[0]);
End_if;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline