Jump to content

Generice way to distribute U8 to various clusters


Recommended Posts

http://forums.lavag.org/index.php?act=attach&type=post&id=5767http://forums.lavag.org/index.php?act=attach&type=post&id=5769

I hope someone can help me think of a way to do the following. I'm getting data from hardware (always U8) that I need to distribute to a series of clusters. Each cluster can consist of various combos of booleans and numerics that total to 8 bits (see an example cluster in the attached VI which is explained below). I need to somehow divide up the incoming bits to the cluster elements. I was hoping to find a generic way of doing this instead of needing a pile of case statements. It would make maintenance easier to when I have to add more clusters. I put the format in the clusters caption that shows how many bits are in each part of the cluster (for the attached VI the caption would contain 1_3_1). I can retrieve the caption in the subVI and that at least gives me some idea on how to distribute the data. I just can't figure out how to bundle the data to send it back to the cluster.

Here's one thing I tried. I converted the cluster (via a reference and then to a variant) to XML, changed a few values in the XML based on the incoming data and then tried to convert back again to a variant to send to the cluster reference value (see attached VIs). Converting to XML is easy, but I get an error when converting back to a variant that says that "the data type of the variant is not compatible with the data type wired to the type input". Is there any way to convert back to a variant? It's easy when the actual cluster is available, but I need to do the conversion in a subvi with a reference to the cluster.

George

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.