-

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

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 has finished and the value AB is copied from the DST 'byteStream' to the structure element 'data.byteElem'.
In order to show the DST value directly (without the WATCHES window), it is possible to assign the structure element to the variable 'byteElem'. Of course it is possible to use the variable 'byteElem' as well as the DST.