xPC Target / Commtech-Fastcomm 422/4-PCI-335F block variable length binary data

1 view (last 30 days)
Hi, I'm actually using xpctarget/commtech-fastcom 422/4-PCI-335F driver block to communicate with RS485 protocol, to send and receive fixed length binary data through a port. Is there a way to send and receive varying length binary messages to a device, through a port of the driver block within a unique model? Thanks for your support. Best regards,

Answers (1)

Gordon Weast
Gordon Weast on 14 Dec 2012
In general the message needs to have some identifier that tells you the length of the message to expect. The most common is to have a message header or preamble that changes depending on the length of the message that follows.
To receive variable length messages on xPC Target, use the FIFO read binary block in the serial IO section of xpclib. You can specify several different headers and the associated message length to expect. The block looks for that header and copies out the specified length to it's output port.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!