LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count up function

Solved!
Go to solution

Hi! I need to write a program which similar to the iteration function. The program will generate a number starts from 0 and it increments 1 until to n each cycle, . After n cycle, the number will reset to 0 and repeatedly. Any idea or working example can provide? Thank you.

0 Kudos
Message 1 of 9
(5,397 Views)

Increment functions counts up (+1)

shift register stores value between iterations.

 

Quotient Remainder function, the remainder output will give you the result between 0 and N-1.

0 Kudos
Message 2 of 9
(5,394 Views)

Thanks for your reply. I am a beginner and not familiar with the shift register function. Would you explain more deeply.

0 Kudos
Message 3 of 9
(5,374 Views)

I had wrote a vi, but the first output is 1, how can i generate 0 for the first output?

0 Kudos
Message 4 of 9
(5,358 Views)

See this topic about shift registers and make some changes in your code to get 1.

http://forums.ni.com/t5/LabVIEW/shift-register/m-p/1778678#M616859

 

 

In your code,

                     You have initialized the shift register with value Zero and would always goes to the false case of case structure.Smiley Wink

 

 

0 Kudos
Message 5 of 9
(5,355 Views)

Sorry about the message that I written about your code. That is wrong statement.

 

By the way, You are incrementing the value for 5 iterations and then it become zero in sixth iteration due to the condition that you have written.

Where you are displaying the message? I don't see any indicator on front panel. Also, try to stop the loop when you get value 0 in shift register.

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

I am using the highlight execution function to real time monitor the output number. My expected result is 0->1->...->5->0->1...->5....repeat forever, but my vi seems can't handle the first condition (0 in but 1 out). I attached the vi with indicator. Please give help, thank you!

0 Kudos
Message 7 of 9
(5,327 Views)
Solution
Accepted by topic author nvnewbie

See this one. This is what you want?

 

 

If you want to see in slow, give much delay time in while loop.

Message 8 of 9
(5,316 Views)

Yes, that's what i need. Thank you very much.

0 Kudos
Message 9 of 9
(5,302 Views)