SET_USINT

Write an unsigned integer value into byte data with offset

This function sets the 8-bit byte value of Data with iByteOffset denoting the offset in byte. The byte numbering starts from 0, which refers to the first byte of Data.

Input

Value (INT, DINT, UINT, UDINT)

The input data from which the lower byte value is written to the byte data of input/output Data.

iByteOffset (INT, DINT, UINT, UDINT)

Byte offset relative to the first byte of Data starting from 0, must be greater than or equal to 0

Input/output

Data (ANY) all simple and derived data types (ARRAYs, DUTs) which do not contain BOOL

Byte data to which the byte is set

Remarks

  • The byte offset is assumed to be greater than or equal to 0.

  • Please check the validity of the input data since the validity of the data to access is not checked.

NOTE

To get the best performance please use constant input values as much as possible!

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.

	VAR
		bStart: BOOL:=FALSE;
		awByteData: ARRAY [0..4] OF WORD:=[100,200,300,400,501];
		iOffs: INT:=2;
	END_VAR

LD body

When the variable bStart is set to TRUE, the function is carried out.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 8 ;
        NETWORK_BODY
B(B_CONTACT,,bStart,4,3,6,5,);
B(B_F,E_SET_USINT!,,11,2,19,8,,?DEN?DValue?DiByteOffset?DData?AData?AENO);
B(B_VARIN,,255,9,4,11,6,);
B(B_VARIN,,iOffs,9,5,11,7,);
B(B_VARIN,,awByteData1,9,6,11,8,);
L(1,0,1,8);
L(1,4,4,4);
L(6,4,11,4);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

if (bSTart) then
	SET_USINT(Value := 255, iByteOffset := iOffs, Data := awByteData);
end_if;

Modified on: 2025-02-28Feedback on this pagePanasonic hotline