03-20-2011 06:55 AM
Hello,
Can anyonce suggest me how to update different value at different time interval.
I want to use only one while loop but I should be able to send data at different rate.
Eg:- I have 3 input ,10,20,30
I need to give output 10 at every 5 ms
20 at every 10th sec
30th at every 13th sec.
so my output should be
10 at 5th sec
10 at 10 sec
20 at 10th sec
30th at 13th sec.
Please let me know if anyone has solution for it.
03-20-2011 06:59 AM
Is it one output, or different outputs?
03-20-2011 09:16 AM
The output should be only one at a time..
As explained earlier.
I need to send every 5th,7th,10th seconds the corresponding output.
like when it is 5th second i should output 10, then at 10th ms i should output 2 output like wise
03-20-2011 09:22 AM
Cant you put the time you started in a shift register and then check how much time has elapsed. If the desired time has elapsed, execute a certain case (with in this case a certain value).
If you want to reset the timer, just put the new time in the shift register.
03-20-2011 10:45 AM
I have already used shift register. My problem is how to keep track of my previous output.
I have problem keeping track
consider i reached 10th sec. At this point i should able to send 2 output. one as a result of 2nd 5th sec and other as a result of 10th sec.
at 10th sec
the output should be
5
5
10
03-20-2011 10:48 AM
you can add a second shift register which holds track of the sequence you were in the last time.
03-20-2011 12:29 PM - edited 03-20-2011 12:30 PM
Is this under windows on in a realtime system?
In the varous posts, you are sometimes talking about milliseconds, sometimes about seconds
You could run a timed loop at 5ms time and use quotient and remainder for each multiple with three parallel case structures.
Here's a possible solution for the case:
03-20-2011 01:14 PM
I did almost the same thing. I basically created a timed loop that "ticks" once per second, wired in an array of intervals (I used 3, 4, and 5 seconds, as they have interesting patterns of when they are coincident and when they are separate), and an array of values to be output at each of these intervals. I chose to simply sum the outputs -- you could easily direct them to multiple output channels (hmm, maybe I'll add that before I paste it in here!).
Bob Schor
.