LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

timer and leaps in time ???

Hello (using LabWindow/CVI 6.0 and WIN2k)

I've written a program, which is a simulation for a machines I/O's.
I have several timer inside with greater count values (about 20 min).

The simulation is for presenting a product to clients.
When we present the product we could not wait that long time, so we need to do leaps in time.
The machine can do very much, so sometimes we don't need to the leaps in time and show in that time the other functions.

So my question is, how can I program the timer, so that the timer does the leaps in time correctly?

thanks
Florian
0 Kudos
Message 1 of 4
(3,064 Views)
What do you mean by "leaps in time"? Why not just change the timer interval so it fires events faster?
What sort of timer are you using?
If you're using a Timer control, use SetCtrlAttribute to modify ATTR_INTERVAL.
If you're using an Asynchronous Timer, use SetAsyncTimerAttribute to modify ASYNC_ATTR_INTERVAL.
You could use a compiler define to set the demo mode. You may end up with other things you want to change for the demo rather than just the timer interval.

#define DEMOMODE 1 // or 0

//...
double myInterval;
//...

if (DEMOMODE)
myInterval = 5;
else
myInterval = 1200;

SetCtrlAttribute (panelHandle, PANEL_TIMER, ATTR_INTERVAL, myInterval);
0 Kudos
Message 2 of 4
(3,056 Views)
with "leaps in time" I mean, I will jump to a later point of time of the simulation (e.g. 5 min)
I'm using asyncTimer, which always start in their own thread.

Your idea to run the timer faster is good opportunity.
When I'm arrived at the later point of time, the timer should go on in the normal mode. So I have to replace the parameter.
But it is good when I think of events which will happen between the two points of time.

My idea first was to replace the value, the timer has arrived since he was started, but this will be a problem with timer, which will finish betwenn the steps.

my first solution is:
Installing a slider to regulate the rate of the timersteps.
First I have to check if I'm allowed to solve this problem this way.

Firstly thanks for your idea.
Florian
0 Kudos
Message 3 of 4
(3,047 Views)
Hi,

You can use the timer from the User Interface controls and take the input from a numeric or slide control from the User interface so that you can adjust it for every run or whenever you want to.

Regards,
Siddu
0 Kudos
Message 4 of 4
(3,037 Views)