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 update numeric indicator with digital input

Solved!
Go to solution

Hello guys,

 

I am attempting to write code to do the following;

 

The USB-6501 P0.0 connected to a switch that is held high via a resistor.

The switch is pressed and I can detect the input (my Panel LED changes color).

I need to update a numeric indicator (I think that is the correct vi I should use) everytime the switch is pressed.

 

Any assistant will be much appreciated.

 

 

0 Kudos
Message 1 of 25
(4,969 Views)

What do you mean by "update a numeric indicator"?

 

What do you want it to show?

0 Kudos
Message 2 of 25
(4,957 Views)

Update with what value? Do you want to count the numer of presses?

0 Kudos
Message 3 of 25
(4,947 Views)

I would like to display the number of times the switch has been pressed. I meant numeric constant.

0 Kudos
Message 4 of 25
(4,945 Views)

Yes, that is correct.

0 Kudos
Message 5 of 25
(4,943 Views)

actually it is numeric indicator is correct.  you can think about the logic necessary to qualify as a change/increment, and that is what you have to program.  And actually for the hardware you are using, I believe there are built in counters that you can use to make your life easier:  http://www.ni.com/pdf/manuals/375267a.pdf

0 Kudos
Message 6 of 25
(4,929 Views)

Yes, the output of the source is 1D Array (TRUE or FALSE) and the type of the sink (numeric indicator) is a double. I am having trouble connecting them together.

I did notice my device has the event counter as shown in the document. Perhaps I'm approching this in the wrong way since I need to have 8 switches and each has their own numeric indicator.

0 Kudos
Message 7 of 25
(4,909 Views)

You should be able to just use a counter to read in the number of edges so you don't even have to convert from the arrray:  http://www.ni.com/f/students/12/7353/en/

But if you want to go that route, you can use a for loop to go through each index of your array.  Just make a for loop, then wire your array into it, and you will see that it automatically takes each index for each iteration of the for loop. 

edit to answer your edit:

So, if you have 8 switches, it would make sense as to why you might be getting an array of 8 boolean, because it is for each of your inputs. 

0 Kudos
Message 8 of 25
(4,897 Views)

Store the number in a shift register.  Use boolean crossing Pt by Pt to determine when the switch changes.  When that is true, then add 1 to the value going into the shift register.

0 Kudos
Message 9 of 25
(4,894 Views)

Pardon my ignorance, what is PT by PT?

0 Kudos
Message 10 of 25
(4,885 Views)