SignalExpress

cancel
Showing results for 
Search instead for 
Did you mean: 

I would like to add a reset counter natively to signalexpress

Solved!
Go to solution

I would like to add a reset counter natively to SignalExpress without calling a VI.  I can count up variable A based on samples taken.  I am countuously sampling every half second using USB-6008 hardware.  I would like it to count to 15, then add 1 to variable B, then reset variable A to 0 and loop.  Would I use a conditional repeat execution control or a sweep execution control?  Thanks. David

0 Kudos
Message 1 of 9
(6,127 Views)

Hi dchalupa,

 

You would use a conditional repeat execution control and check the box to "Reset steps when loop begins" to reset it to 0. If this loop is nested inside of another loop, the the outer loop will only iterate when the conditional loop runs 15 times (or another amount you set).

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 9
(6,107 Views)

  

Justin M.
Applications Engineering
National Instruments
0 Kudos
Message 3 of 9
(6,106 Views)

Thank you for for information.  The nested loop did work, but then I have another problem because the counter I was resetting was based on the statistics/number of samples function.  When it resets the logging is messed up.  The USB-6008 does not have a hardware counter, is there a software work around in SignalExpress?  Thanks again.

 

David 

0 Kudos
Message 4 of 9
(6,038 Views)

The statistics step and similar are applied to the entirety of the signal passed.  To reset the statistics, then one must "reset" the signal.  I use the Subset step to chop up the signal as acquired and pass that subset to the statistics step or any other processing/analysis steps.  Does that help?

0 Kudos
Message 5 of 9
(6,033 Views)

I appreciate and understand what your saying, I am just having a little trouble putting it into practice.  Could you send me an example or screenshot of how to reset one part of the signal without resetting the original signal.  Thank you very much.

 

David

0 Kudos
Message 6 of 9
(6,005 Views)
Solution
Accepted by topic author dchalupa

I was re-reading your original post and it seems to me that the task is to count the pulses of a half-second clock.  The counting should be stored in a U32 variable, "TicsTot".  Since the task is to roll over the count at 15+1=16, then this is all just four-bit (4b, 2^4=16) arithmetic and a digital computer makes this easy.


Continuously calculate another U32, "TicsA" aka your "A", which are the Least Significant Four Bits; and another U32, "TicsB" aka your "B", which are the Most Significant Bits right-shifted four bits.  When TicsTot is generated then just use a Formula step where Result=int(TicsTot/16) to calculate TicsB, then another Formula step where Result=TicsTot-(TicsB*16) to calculate TicsA.  This is all simple bit manipulation.

So how to create TicsTot?  Simply pass your acquisition to the Statistics step and ouput the count of samples, or TicsTot.  so:

Acquire Step - acquire signal with 0.5 sec period, output signal, right-click on step output and rename to "Signal"
Statistics Step - input "Signal", output "Nb of samples"
Formula Step - input "Nb of samples" as x0, and formula=int(x0/16), right click processed data and rename to "TicsB"
Formula Step - input "Nb of samples" as x0, input "TicsB" as x1, formula=x0-(x1*16), right click processed data and rename "TicsA"

I believe this is the solution for the task that you outlined.

Message 7 of 9
(5,998 Views)

Thank you very much that worked beautifully.  I agree it is simple bit manipulatuion, but not being a programmer it was not obvious bit manipulation.

 

David

0 Kudos
Message 8 of 9
(5,979 Views)

David,

It would be very nice of you to either declare this "Solved" and/or give "Kudos".  Just click on either button as they appear on the screen.

Best Wishes

Message 9 of 9
(5,970 Views)