F151_WRT

Write into memory of intelligent units

Writes data into the shared memory of an intelligent unit.

Parameters

Input

s1_BankSlot (WORD, INT, UINT)

Specifies the bank/slot number in the shared memory of the intelligent module

s2_Start (WORD, INT, UINT)

Starting address for data in the shared memory of the CPU

n_Number (INT)

Specifies the number of words to be written to the shared memory

d_Start (WORD, INT, UINT)

Specifies the starting address in the intelligent unit for storing data written (destination address)

Remarks

Writes n_Number words of the initial data from the area specified by s2_Start of the CPU to the address specified by d_Start of the shared memory of the intelligent unit specified by s1_BankSlot.

The number of variable arguments at the inputs is limited by the available index registers of the PLC.

Specifying s1_BankSlot

  • Intelligent unit without bank

    Specify the slot number in which the target intelligent unit has been installed.

  • Intelligent unit with bank

    Specify the slot number (hex. constant) in which the target intelligent unit has been installed, and the bank number (hex. constant).

   
 

Name

Order Number

 

FP3 expansion data memory unit

AFP32091

AFP32092

 

FPS expansion data memory unit

AFPG201

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if s1_BankSlot exceeds the limit of specified range

  • if the data read exceeds the area of d

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if s1_BankSlot exceeds the limit of specified range

  • if the data read exceeds the area of d

Example

POU headerCopy code to clipboard

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;
			(*activates the function*)
		SlotNo: WORD:=16#0D;
			(*if start is TRUE, this value
will be written to the address
1 from the unit-slot 0*)
		CPUDataToWrt: ARRAY [0..4] OF INT:=[5,10,15,20,25];
		NoWordsToWrite: INT:=5;
		DestinationAddr: INT:=0;
	END_VAR

POU body

Five words of data defined in CPUDataToWrt are written into the addresses starting from 0 to 4 of the intelligent unit's shared memory (located in slot 0) when Start turns on.

  1. Slot No.
  2. CPU
  3. Intelligent unit
  4. 5 words

LD bodyCopy code to clipboard

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,,SlotNo,11,3,13,5,);
B(B_VARIN,,CPUDataToWrt[0],11,4,13,6,);
B(B_VARIN,,NoWordsToWrite,11,5,13,7,);
B(B_VARIN,,DestinationAddr,11,6,13,8,);
B(B_CONTACT,,Start,7,2,9,4,);
B(B_F,F151_WRT!,Instance,13,1,21,8,,?DEN?Ds1_BankSlot?Ds2_Start?Dn_Number?Dd_Start?AENO);
L(9,3,13,3);
L(1,3,7,3);
L(1,0,1,8);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST bodyCopy code to clipboard

IF start then
    F151_WRT( s1_BankSlot:= SlotNo,
         s2_Start:= CPUDataToWrt[0],
         n_Number:= NoWordsToWrite,
         d_Start:= DestinationAddr);
END_IF;

Modified on: 2019-01-25Feedback on this pagePanasonic hotline