06-28-2012 06:54 PM
Hi, I have a 16 bit array of boolean values, and I want to be able to change one bit, and only one, when the appropriate input to the VI changes.
As background, I have a 16 bit port expander (I2C) and I need to change just one bit, ie set one of the outputs on or off, without affecting the others. To do this, I read back the 16 bits so I know what the current states of the outputs are, then I need to change one bit, and write the 16 bits back in.
I looked at the Replace Array Subset block, which seems to be related, but since I only need to change one of the bits at a time, I dont see how I can connect up controls to all the 16 bits and modify only the one I need to change.
Is there an elegant way of doing this? For example can I have a combo box with the names of the ports in it, so the user can select the port they need to change, and then they set the state of a toggle switch or boolean value to set the bit, and only that bit? Thanks for any advice.
Solved! Go to Solution.
06-28-2012 08:32 PM
06-28-2012 09:08 PM
Brilliant! Exactly what I needed, thanks. I think my understanding of the Replace Array Subset block was flawed.
Much appreciated.
09-01-2015 04:16 AM
Could you please advise how to change square type boolean array to be round type programatically? Thanks for answer
09-01-2015 05:25 AM
09-05-2015 02:49 AM
actually I want to replace the round type boolean array other size or shape. Is it possible to copy and paste during runtime?
09-06-2015 04:15 AM - edited 09-06-2015 04:16 AM
Hi arifi,
at runtime you cannot edit a running VI: so the answer to your question is "NO"!
But there are surely options to reach your goal: you might use picture rings or the 2D picture indicator instead of boolean arrays…