LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Xbee API Frame - ADC Data decoder

Hello,
I am receiving data from the serial port from an XBEE and I want to take the portion 
corresponding to a value within the payload. So far, I have extracted the portion and regenerated the numeric data with Type Cast.
But that data I only managed to indicate in U16. My problem is that since I need to manipulate that data in a mathematical formula, I must
treat it as SGL and I do not know how to get it with Type Cast or something like that. This result will be to show on a humidity and a temperature indicator. Below I leave a
schematic where I get the plot and I get some data like the one I need. For any question about what each byte in the Zigbee package means, I leave a link
(http://docs.digi.com/display/RFKitsCommon/Frame+structure). And My Diagram
Thank you all and have a great day.
0 Kudos
Message 1 of 4
(2,888 Views)

Hi Paul,

 

So far, I have extracted the portion and regenerated the numeric data with Type Cast. But that data I only managed to indicate in U16. My problem is that since I need to manipulate that data in a mathematical formula, I must treat it as SGL and I do not know how to get it with Type Cast or something like that.

So you know how to typecast to U16, but you don't know how to typecast to SGL? Really?

Maybe you just need to think about that one more minute 😄

 

Using BytesAtPort seems wrong to me!

All you need to do is waiting for the start delimiter, then read another 2 bytes and convert them to the "length" parameter. Then read "length" more bytes containing the frame data and one more byte with the checksum. When the received checksum is wrong you didn't start your message at the right offset in the stream - the start delimiter might also occur within the message… In this case just throw away the message and search for the next start delimiter!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,848 Views)
Thanks Gerd, I know that it is quite untidy and even unintelligent and it is because the simulation is built Frankenstein type thanks to take examples and interconnect them to understand their function and thus increase my knowledge of the application in general. That is why I have even expressed myself in my need. The output that I need to achieve, in the pure data portion, is numerically "orange" and then perform the calculations in a formula for converting the data delivered by the Xbee ADC port to display the temperature and relative humidity. This is to avoid having an additional microprocessor to which already has my Xbee (XBee-900HP-Pro) lower consumption and thus delegate the processing at destination.
0 Kudos
Message 3 of 4
(2,829 Views)

Have you tried this?
SGL.png

You could also place an SGL constant as "type" in the Type Cast Function

Kudos are welcome 😉 marked solutions are awesome!
0 Kudos
Message 4 of 4
(2,809 Views)