Reading and writing UDT

48 views
Skip to first unread message

Alex Fabijanic

unread,
Aug 19, 2025, 12:02:20 PMAug 19
to libplctag
Hello,

Is there a way to get any data type (including UDT) as a bare raw byte buffer? I've been away from AB for some time and things have changed since the PLC5 times - we used to store the UDTs in the (I think) N files, fetching the datablock chunk raw and simply memcpy-ing it on the C structs. 

Is it possible to get any tag content (including UDT data) from the PLC as a raw bytes buffer and map it onto an in-memory C struct?

Thanks,

Alex


Kyle

unread,
Sep 4, 2025, 2:32:31 PMSep 4
to libplctag
libplctag reads a UDT into a raw byte buffer.  Then you can access it with the data accessor functions.   I would not use memcpy() personally.   The alignment of fields in UDTs is not necessarily the alignment that C has.

There is a data accessor function that copies the raw bytes into a buffer you provide.   

I hope that helps.

Best,
Kyle
Reply all
Reply to author
Forward
0 new messages