Skip to content

mbus HFCE Message At Index.vi


Description

The HFCE Message At Index is an easy function to extract HFCE Messages out from HFCE data. HFCE message lengths may vary from one message to the next. This function uses the payload size of each message to parse multiple received HFCE messages into individual messages.

Attention, corrupted data in the payload size word may result in parser misalignment.

Refer to HFCE Packet At Index to extract HFCE Messages from corrupted HFCE data.

For example:

Received hfceMsgs shows:

hfceMsgs word # 16-bit word
Index #0 0x00AA (message 1's label)
Index #1 0x0003 (payload size)
Index #2 0x0011 (data 0)
Index #3 0x0022 (data 1)
Index #4 0x0033 (data 3)
Index #5 0x00BB (message 2's label)
Index #6 0x0004 (payload size)
Index #7 0x1100 (data 0)
Index #8 0x2200 (data 1)
Index #9 0x3300 (data 3)
Index #10 0x4400 (data 4)

By using mbus HFCE Message At Index in a loop, returned HFCE messages are:

Message #0 16-bit word
Label 0x00AA
Payload size 0x0003
Data word #0 0x0011
Data word #1 0x0022
Data word #2 0x0033
Message #1 16-bit word
Label 0x00BB
Payload size 0x0004
Data word #0 0x1100
Data word #1 0x2200
Data word #2 0x3300
Data word #3 0x4400


Parameters  
error in in error conditions that occur before entering the function
hfceMsgs in HFCE receive messages
wordCount in number of HFCE words received
msgIndex in start index of the HFCE message to decode. This should point onto a label word.
label out HFCE message label
payloadSize out HFCE payload data size in 16-bit words
payloadData out HFCE payload data
nextMsgIndex out start index for the next HFCE message
error out out error information
function return out function execution status


Availability

Available in Multibus VI 1.0 and later.

See Also

mbus HFCE Packet At Index.vi

Examples

HFCE Add Message To Buffer.vi