LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have a ASCII input feeding a value in. Each time this value falls between two numbers I want to increase the count by 1. How can I do this?

I have been trying to work this out an I am sure is is not too difficult to do, but I cant seem to get anywhere with it. If anyone could help that would be great.

Thanks

RossH
0 Kudos
Message 1 of 2
(2,449 Views)
I am not currently at a PC with LabVIEW on, so Ic ant send you an example of how to do this. Instead you'll have to understand my description....

I'll assume that you want to constantly monitor the input value...

Use a while loop with a shift register to store the count value. You can initialise the count value to zero (or whatever you like) by wiring a numeric constant to it - to the left of the shift register - outside the loop. Place a case structure inside the loop and wire the shift register left to right through the false case. In the true case place the increment function and connect it between the input and output nodes you now have on the case structure. On each iteration of the loop the count value will either remain the same or be incremented b
y one depending on whats wired to the boolean input on the case structure. Now you need to detect whether your ascii value is in range. You can use the 'In range and coerce' function for this (found in the comparison function pallette). Wire the range values and the input value to it and take the boolean output to the input of the case structure. The ascii value must be acquired within the loop, so that you are checking the updated value on each iteration (or if it comes via an array you could wire the array directly to the outside of the loop and enable indexing - in this case it would be best to use a for loop). You can place an indicator on the 'count' wire to monitor its value if you wish. Remember to also place some conditional statement to stop the loop when required and also a wait function should exist inside the loop. When the loop stops, the count value will be available at the output of the shift register.

Hope this helps and is clear enough for you to implement?!
Message 2 of 2
(2,449 Views)