BYTE_TO_BUF example
Data type declaration:
TYPE
dtStruct: STRUCT
byteElem : BYTE;
wordElem : WORD;
END_STRUCT;
END_TYPE
TYPE
BYTE_ARRAY : ARRAY[0..200] OF BYTE;
END_TYPE
'Variables' table with declarations:
Code:
A structure element 'data.byteElem' is used in this example. At first the value to be copied has to be assigned from the variable 'byteElem' to the structure element. Of course it is possible to use the variable 'byteElem' as well as the
SRC.
After a rising edge has been put to the
REQ input, the copy process starts. TRUE is written to the variable 'DoneByte' if the writing process is finished and the value AB is copied from the
SRC structure element 'data.byteElem' to the
'byteStream'.