LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

count up and down using shift registers and a boolean control

Hi everybody!

what i want to do is as follows: every time  i press the boolean control i want to count from zero up to ten with increments of one (0,1,2,3...10). When i reach ten, i want to go backwards(10,9,8...0). The process should continue like this,going up and down(from zero to ten and from ten to zero and so on). So far i've got this!.....Thanks in advance!

0 Kudos
Message 1 of 7
(3,571 Views)

Hi riot,

use another shift register for a flag to indicit, if you count up or down.

  

Mike

0 Kudos
Message 2 of 7
(3,559 Views)
Hi Mike! thanks for replying! Can you post some code please, i do not understand exactly  how to do it, and maybe you can give me a brief explanation about the concept of  "flag index" ...thanks in advance !
0 Kudos
Message 3 of 7
(3,530 Views)

Hi riot,

see the attached example. It´s also possible without the event case.

 

Hope it helps.

Mike

0 Kudos
Message 4 of 7
(3,526 Views)

 Thank you so much for your help Mike! That's exactly what i needed.  Now I'll try to do it without using the case event as you propose!

0 Kudos
Message 5 of 7
(3,509 Views)

One shift register is plenty (under some conditions none is needed). 🙂

 

Here is some simple code that shows the basic idea. See if it works for you. For simplicity, you could even wrap the math portion into a subVI.

 

It would be trivial to adapt it for the case where the lower turning point is not zero, try it!. 😉

 

(Note also that the indicator should always go before the event structure, else it could show a stale value until the event executes for the first time)

 

Message Edited by altenbach on 09-01-2008 11:27 AM
Download All
Message 6 of 7
(3,503 Views)
Cool!!! now another way to do it! Thanks Altenbach,first  i'll try  to understand the logic, then i'll implement it... I'll let you know what happens! and Thanks one more time!
0 Kudos
Message 7 of 7
(3,457 Views)