05-27-2013 09:59 AM
I am having DC power supply which is having two output channel, each channel is able to give two different voltage at a time. i want to change the voltage for both the channels with two differnet period of time. ex: channel1 voltage will change every 2mins period of time and Channel2 voltage will change every 5mins period of time. so please give me the suggestion for this problem thanks in advance.
Solved! Go to Solution.
05-27-2013 10:22 AM
Check the time every minute. If divisible by 2, change channel 1. If divisible by 5, change channel 2. Of course when it it divisible by 10, both conditions are satisfied and both channels will be changed.
This is not a very flexible approach. Another way is to calculate the next change time for each channel when the program starts or when a change is made. Each time through the loop, compare the current time to the "next change times" for all the channels. For each channel where current time is >= next change time, update the voltage and calculate the new next change time. Keeping the next change times in an array in a shift register allows any number of channels without changes to the program. It is also possible to have variable intervals for the channels, such as channel 1 changes every 2 minutes for the first 20 minutes and then evey 7 minutes after that.
Lynn
05-27-2013 12:21 PM
Thank you for response i can't get your logic so please explain me in detail it would be helpful for me please
05-27-2013 12:48 PM - edited 05-27-2013 01:00 PM
05-27-2013 01:12 PM
Thank you so much Johnsold,now i got the logic and very thanks to apok for explain the logic clearly through code