LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

converting a binary array to decimal or hexidecimal array within a cluster

Is it possible to convert a binary array to a decimal array or hexidecimal array within a cluster.
I like to give the user the option of view the serial registers either in decimal,binary or hex.
0 Kudos
Message 1 of 4
(4,213 Views)
You can create three cluster indicators. Right click on each element in the first cluster and configure the format and precision to binary, 4 digits. On the second cluster, configure for floating point and 2 digits. On the third, configure for hex and 2 digits. Then overlay each cluster so that they all stack on top of each other. Then in the block diagram, wire the three clusters together and create visibility property nodes for each cluster. Create a case structure wired to the ring. For case 0, send a True constant out of the case to visibility #1, and False to #2 and #3. For case 1, wire a True to visibility #2, and False to #1 and #3. For case 2, True to #3, False to #1 and #2. Be sure to put the property nodes outside the case so you don't have to create nodes for each case. See attached example.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 4
(4,197 Views)
Personally, I would use a tab control so the user can switch between them at any time without the need of additional code.

If this is a subVI, maybe you should rethink if you really want to carry this complex cluster in your code. I would think that a simple 2D U8 array is much easier to manage and you can always format it for display any way you want later.

Another possibility would be to use a simple string as indicator. In this case you can even include the labels.

The attached code (LV7.0) Shows some of the possibilities:
- Tab(binary, decimal, hex)
- 2D U8 Array (binary only)
- String output (binary only)

Just some ideas! 🙂
Message 3 of 4
(4,190 Views)
Another idea (continuing from altenbach's 2D array suggestion):

Why not just make the radix visible and use it to toggle the display? You could do this in your cluster, but an array has the advantage of only 1 toggle rather than 10.

If you want to avoid the octal and SI displays, you could use property nodes, but you may not want to do that.

... and if you absolutely want to do it with your cluster, it's a bit more code.

Demo in LV6.1 attached.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 4 of 4
(4,162 Views)