ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How To Read/Modify/Write Array?

Ive got a bunch of switches, where each switch represents a bit in a
word...

So from each switch, in the control panel, it goes throu a boolean to
integer vi, and then to a x*2^n vi.
I then set a constant for each n.. so that if the switch is true (x=1
after the conversion) and n = 5 for that switch,
then the output will be 1 * 2^5.

Finally, I add all 16 outputs together (x*2^0 to x*2^15) to create a
word.. I actually have so many switches
that I have a couple of words (each made up with the above scheme)!

So far, this works fine, however, my question is, I would like to have
a global array that contains these words. I
dont want to insert this word into the array, but rather, I'd like to
sort of latch the values...
If in the array's word, the n bit was already one (i.e. that switch at
one point was on), then I dont want to reset it
to 0, even though the switch is off now.

This probably sounds confusing, I know I am confused just reading that
back, anyhoot, if I could make a global
array (ten 16-bit unsigned words), that I can read any word from,
modify it and set it back to its same place,
that would be great!

0 Kudos
Message 1 of 3
(3,441 Views)


@Anonymous wrote:
This probably sounds confusing, I know I am confused just reading that
back,

Definitely confusing!

You might want to attach your code so we get a better idea on what you're up to. 🙂

Typically, if you have an existing array where you want to replace elements, keep the array in a shift register and use "index array" to read elements and "replace array subset" to change elements at a certain index location.

0 Kudos
Message 2 of 3
(3,437 Views)
Hi Anonoymous

Here's one quick example that does what you want, it functions like a function global and relies on boolean logic.

For your own experience I challenge you how to reset just one bit or word.
Also you have to connect the connector pane.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 3
(3,417 Views)