LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift register for continuous count

Hello, 

 

I am checking this string value (red marking) in the entire string what is send. If the string which I am looking matches means, my LED will glow or it won't. I want to note down how many time does my LED blink. I was using Comparison -> Select block to count the value. it's not counting continuously. If the string which I am looking appears it starts to count, once it disappeared the value not remains in the last count, it falls back to zero and starts again. I want to read it from the last count.  

jrengg_1-1677830171975.png

Please give me your valuable solutions.

 

Thanks in advance,

JrEngg

 

0 Kudos
Message 1 of 8
(1,388 Views)

Hi,

Without the full VI and only with assumptions, what does it do when you wire the register shift wire without that +1 to the False side of the select block ?

 

Here a quick proposal

selector.png

Message 2 of 8
(1,383 Views)

The essence is: you have a main While loop most likely, put the shift register there.

0 Kudos
Message 3 of 8
(1,376 Views)

I'm not a fan of PtByPt VIs, but "Increment PtByPt.vi" does that OoTB.

 

Use QD to find it.

wiebeCARYA_0-1677833270431.png

Since the PtByPt VIs are reentrant VIs that keep state (you can look into the VI to see how), you can't use PtByPt to work on items in an array, or in sub VIs that you use in several places (unless the parents are clones too).

 

But for your case, "Increment PtByPt.vi" will work well.

Message 4 of 8
(1,371 Views)

@jrengg wrote:

I am checking this string value (red marking) in the entire string what is send. If the string which I am looking matches means, my LED will glow or it won't. I want to note down how many time does my LED blink. I was using Comparison -> Select block to count the value. it's not counting continuously. If the string which I am looking appears it starts to count, once it disappeared the value not remains in the last count, it falls back to zero and starts again. I want to read it from the last count.  

jrengg_1-1677830171975.png

 

Please give me your valuable solutions.


You talk about a shift register in the subject, but then you are showing us a severely truncated picture that does to not even contain a shift register. Then you talk about counting, but using orange wires instead of integers.

 

You also need to define the term "blink", for example if it remains TRUE for five iterations, is that one "blink" or five "blinks"?

 

Since we don't see the entire code, we don't even know if you actually have a toplevel while loop (good!) or just using the "continuous run" button (bad!).

 

If you simply want to count how many iterations the comparison is TRUE and you actually have reasonable architecture, the following would work (If the count is expected to exceed ~32k, a little more code is needed):

 

altenbach_0-1677853803425.png

 

0 Kudos
Message 5 of 8
(1,313 Views)

@altenbach wrote:

If you simply want to count how many iterations the comparison is TRUE and you actually have reasonable architecture, the following would work (If the count is expected to exceed ~32k, a little more code is needed):

 

altenbach_0-1677853803425.png


Change that constant to a U64 and you'll be safe for at least a few dozen decades.

0 Kudos
Message 6 of 8
(1,295 Views)

wiebe@CARYA wrote:

@altenbach wrote:

If you simply want to count how many iterations the comparison is TRUE and you actually have reasonable architecture, the following would work (If the count is expected to exceed ~32k, a little more code is needed):

 

altenbach_0-1677853803425.png


Change that constant to a U64 and you'll be safe for at least a few dozen decades.


I would consider that "a little bit more code", because we also need to change the representation of the indicator 😄 (... and then another little bit more code is needed to get rid of the benign coercion dot if desired.)

0 Kudos
Message 7 of 8
(1,287 Views)

@altenbach wrote:

wiebe@CARYA wrote:

@altenbach wrote:

If you simply want to count how many iterations the comparison is TRUE and you actually have reasonable architecture, the following would work (If the count is expected to exceed ~32k, a little more code is needed):

 

altenbach_0-1677853803425.png


Change that constant to a U64 and you'll be safe for at least a few dozen decades.


I would consider that "a little bit more code", because we also need to change the representation of the indicator 😄 (... and then another little bit more code is needed to get rid of the benign coercion dot if desired.)


I couldn't know that that indicator isn't set to 'adapt to type'! 😂

0 Kudos
Message 8 of 8
(1,274 Views)