I would like to have a counter that initializes at zero and counts up to 1 in increments of .01 and when 1 is reached, the counter would then decrement back down to 0 in .01 increments. The counter would run continuously for comparison to a analog input. The output from the compare would be sent to a digital output producing a simple PWM signal. The increment/decrement rate needs to be 50 times per second. That is increment or decrement by .01 every 1/50th of a second. Thanks for any replies. Chris
Looks like a rare time for Sequence structures in a continuous while loop (count up, count down, & repeat. 1/50 of a second is 20 msec, so I added that time delay for each count - its accuracy will be dependent on your computer clock, but should be within a usec. See if the attached helps, good luck with it, Doug
Thanks Doug. I have not yet figured out how to affect the count down speed or the increment. I found another solution using a for loop in a continuous while loop. Inside the for loop is an array holding the numbers 0-100 and 99-1. cycling through does what I need also. See the attached VI.
Not exactly sure what you mean on 'affecting the count down/up speed', but if that value needs to be variable, change the ms constant to a control on your front panel - so you can change it easier. If it needs to programmically vary, then wire that value (from its source) in place of the constant. ??