11-20-2011 10:00 PM
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.
Solved! Go to Solution.
11-20-2011 10:15 PM
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.
11-21-2011 03:13 AM
Thanks for your reply. I am a beginner and not familiar with the shift register function. Would you explain more deeply.
11-21-2011 05:11 AM
I had wrote a vi, but the first output is 1, how can i generate 0 for the first output?
11-21-2011 05:44 AM
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.
11-21-2011 06:03 AM
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.
11-23-2011 01:28 AM
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!
11-23-2011 03:04 AM - edited 11-23-2011 03:08 AM
See this one. This is what you want?
If you want to see in slow, give much delay time in while loop.
11-23-2011 03:54 AM
Yes, that's what i need. Thank you very much.