Adr_Of_VarOffs

Returns the input or output address with offset

This function returns the address of a variable with offset at the input or output of a basic function.

Parameters

Input

Adr (ANY)

This pin must be connected to the input/output of a basic function for which the data type INT, WORD is allowed

Yields the 16-bit offset address of the input/output variable

Offs (INT)

Input/output variable for which the 16-bit offset address is needed

Output

Var (ANY_IN_UNITS_OF_WORDS)

Output variable for which the 16-bit final address is needed

Remarks

  • From the variable at input/output Var, the 16-bit address, which is raised by the value given at input/output Offs, is yielded at input/output Adr. This input or output has to be directly attached to the 16-bit input or output of a basic function. This function can only be used to work with applied data of a string, i.e. with characters without the string header.

  • Only for LD and FBD Editors: Use “Input instruction” or “Output instruction” from the “Instructions” pane to insert the instruction required into the programming window.

Example

Global variables

In the global variable list you define variables that can be accessed by all POUs in the project.

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.

	VAR_EXTERNAL
		ReceiveBuffer: ARRAY [0..15] OF WORD:=[16(0)];
	END_VAR
	VAR 
		Receive: BOOL:=FALSE;
		ReceiveString: STRING[30]:='';
	END_VAR
	VAR CONSTANT 
		StringTotLenPos: INT:=0;
		StringActLenPos: INT:=1;
		StringHeaderSize: INT:=2;
	END_VAR
	VAR 
		@'': @'';
	END_VAR

LD body

When Receive is set and the reception-end character is received, i.e. R9038 is set, the characters in the buffer ReceiveBuffer received via the serial interface are copied to the applied data area of the string ReceiveString. The number of received characters is stored in ReceiveBuffer[0]; then follow the characters of the string received. Hence, ReceiveBuffer can be copied directly into this area of the string from this position.(see data type STRING). The position of the buffer ReceiveBuffer has to be assigned in the global variable list according to the settings in system regísters 417 and 418 (for detailed information, please refer to Setting receive buffer for CPU).

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 10 ;
        NETWORK_BODY
B(B_COIL,,sys_bIsComPort1ReceptionDone,7,1,9,3,);
B(B_CONTACT,,Receive,16,1,18,3,);
B(B_F,F10_BKMV!,Instance,20,0,28,5,,?DEN?Ds1_Start?Ds2_End?AENO?Cd_Start);
B(B_VARIN,,ReceiveBuffer[0],18,2,20,4,);
B(B_VARIN,,ReceiveBuffer[15],18,3,20,5,);
B(B_F,Adr_Of_VarOffs_I!,Instance,20,6,29,10,,?D@'Var'?DOffs?CAdr);
B(B_VARIN,,StringActLenPos,18,8,20,10,);
B(B_VAROUT,,ReceiveString,29,7,31,9,);
L(1,2,7,2);
L(9,2,16,2);
L(18,2,20,2);
L(28,3,28,6);
L(20,6,28,6);
L(20,6,20,8);
L(1,0,1,10);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

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