LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to restart a number counter?

So I have this number counter. In it's indicator it counts up by 1 every second. It works fine. But at around 32 I want it to start back at 0. Right now it justs keeps counting up for forever. Any idea how to do this? Every option I've tried to implement has not worked and been way more complex than I think it should be.

0 Kudos
Message 1 of 6
(3,408 Views)

mhh am not sure if you are trolling or not

 

try modulo?


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 2 of 6
(3,389 Views)

Hi Orta,

 

you should alway attach your VI to get comments on improvements or solutions to your question…

 

When you don't know about a basic modulo math operation you should be able to implement some pseudocode like this:

counter++
IF counter >= limit THEN
  counter:=0
ENDIF

(Compared to modulo operation it's slightly "Rube-Goldberg"ish… 🙂 )

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 6
(3,379 Views)

Thanks for the replies. No, I definitely understand the pseudo code. In C++ this is a simple operation. But, I dunno, the syntax of labview is weird for me. Getting used to it though.

0 Kudos
Message 4 of 6
(3,374 Views)

thats a minimal example

 

the function is called "Quotient & Remainder"


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 5 of 6
(3,367 Views)

Hi Orta,

 

you should have had the time to go through all those FREE online resources offered by NI for LabVIEW beginners…

 

Conversion of my pseudocode to LabVIEW G:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(3,357 Views)