LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Switching between 2 string values

Solved!
Go to solution

Smiley Surprised

 

Are you kidding us? Smiley Very Happy

 

well, the while loop runs till you press the stop button.

The current time in ms is divided by 200 (modulo operation and remainder)

Do you know what "qoutient and remainder" does ?  ( http://en.wikipedia.org/wiki/Modulo_operation )

It divides the input value (here it's the current time in ms) and calculates an integer for the quotient (this is called the modulo operation) and the remainder (as an integer of course too)

 

Your time increases. (for example simple values:)

0 mod 200 => q = 0 ; r = 0

1 mod 200 => q = 0 ; r = 1

2 mod 200 => q = 0 ; r = 2

3 mod 200 => q = 0 ; r = 3

.

.

199 mod 200 => q = 0 ; r =199

200 mod 200 => q = 1 ; r = 0

201 mod 200 => q = 1 ; r =1

.

.

89075 mod 200 => q = 445 ; r = 75

89076 mod 200 => q = 445 ; r = 76

89077 mod 200 => q = 445 ; r = 77

.

.

 

Thus the remainder is somewhere between the values 0 and 199

 

The 100 before the greater or equal decides if the remainder is greater or equal to 100.

If true the "100..199" string is selected and concatenated. If false the "000..099" string is selected and concatenated.

 

The time delay is the 20 ms at the "wait ms.vi"

 

Thus every 20 ms there is an decision if the remainder of and modulo operation (current time mod 200) is greater or equal to 100.

Thus every 100 ms the string switches from 000..099 to 100..199 and back to 000..099 and so on.

 

Best regards,

 

Balze

0 Kudos
Message 11 of 11
(335 Views)