11-05-2012 03:10 PM
Hello
I use this block diagram to close or open valve in our system.
For different process, controled by state machine,
valves have different state, My system has 16 valves, so for each case, I have use this 1-D Boolean array to change each element value. Is there any other simple way to change 16 values which is written into data termial of DAQ write?
Thanks
11-06-2012 06:23 AM
You can use 16-bit integers rather than the 16-element boolean arrays. Just choose a different polymorphic version of the Digital Write.
If the values are all known and fixed (unchanging with time), you could create an array outside the state machine and just use Index Array inside to select the appropriate value. This has the advantage that if the values ever need to be changed, there is only one place to change. This reduces the chances of missing some changes.
Lynn
11-06-2012 01:21 PM
If I use U8 or U16
It means 0 is true. 1 is false, right?
11-06-2012 01:32 PM
@dragon-long wrote:
If I use U8 or U16
It means 0 is true. 1 is false, right?
Each bit of the U8 (or U16) will correspond to a digital line (bit 0 -> P?.0, etc.). A 1 in the bit will correspond to a TRUE for that digital line.
For instance, writing a 36 (0b00100100) will turn on lines 2 and 5 while turning the others off.