LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

proper representation of digital IO

When programming a digital IO board, I'm using a 2-D array of booleans to represent the state of the digital IO.  When I expand the array, it's easy to see the states of all the outputs, with one major exception.

LabView array expansion/representation starts with the lowest indexes on the left, for a boolean word, the MSB must be on the left with the LSB to the right -- in other words, it's easy for the end user to misinterpret the outputs, even with a label indicating LSB.

The question becomes obvious, is there a way to expand and display a LabView array control (or indicator for that matter) such that the lowest indices are on the right?  I've never seen negative indices, don't see a way to trick LV that way -- other than that, I'd have to reverse the words when reading or writing to that control (indicator).

The problem with the work-around is that when you mix 8 and 16 bit DIO's, keeping track of displayed array index becomes unmanageable (I still haven't found the array property to change the displayed index).

   ...Dan
0 Kudos
Message 1 of 7
(3,358 Views)

I don't know of any properties for reversing the order of displayed items in a 2-d array control.  You are right in saying that you would have to programatically reverse the data in each row before displaying it in your 2d array indicator.

Possibly a better option to use on your front panel over a 2d array would be the Digital Table control.  It displays binary data with the LSB on the right and the MSB on the left. You can still keep your data under the hood as a 2d array of booleans, just use the "Boolean Array to Digital" VI in the waveform palette to convert your 2d boolean array to a digital waveform for display on the table.

0 Kudos
Message 2 of 7
(3,347 Views)
Cute solution.  If only I could click-on/click-off the values.  Clicking and typing either a 1 or 0 is not nearly as convenient.  Unfortunately, the best solution for the end-user is more important than the best solution for the programmer -- I guess I'll have to rotate the arrays to process them.

Thinking out loud, if I support both 8 and 16 bit words, the end user will be equally confused that the parallel port is being represented as 16 bits, or that the word is left justified (in the array) with the LSB in the middle.  I suppose I can zero out the bits above 8 if the user insists on clicking them.

I can't win.

   ...Dan
0 Kudos
Message 3 of 7
(3,336 Views)

Don't give up so easily.

I've included a picture of what I think you are trying to accomplish with mixing 8 and 16 bit words. If I understand correctly, then you could do what you want with and array of clusters containing and array of booleans.  Doing this will require some processing of the data, but it gets you the user interface you want.

Message 4 of 7
(3,325 Views)
Logically speaking, shouldn't a digital word by right-justified?

I've mocked it up as per the attached.
0 Kudos
Message 5 of 7
(3,304 Views)
ok, you are right. The items should probably be right justified. You can still do some LV magic to get your items right justified and still have the upper 8 bits grayed out for your 8 bit only case.  Rather than having just one array of booleans in your cluster, split it into two seperate 8 bit arrays. One for the lower 8 bits and one for the upper 8 bits. If you don't put any data in the upper 8 bits, they will stay grayed out. However, the user could still click on an item in those upper 8 bits and essentially enable them, so you will have to do some filtering.
 
Hope this helps, because I'm out of suggestions.
 
Whoops, the upper and lower labels are reversed in the picture, but you get the point.

Message Edited by JaredW on 03-08-2006 02:28 PM

Message 6 of 7
(3,296 Views)
I like your idea of grouping them in groups of 8, maybe I can set up a hex control above groups of 4 for a super-duper user interface.  The user can them click on individual bits or type "F" to set all 4 bits to 1.  I'd have event-driven modification of the controls keep everything consistent.

Thanks, the discussion was useful.

   ...Dan
0 Kudos
Message 7 of 7
(3,281 Views)