Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

timer event not firing

I have a situation in which the timer_event does not fire. The timer interval is 100 ms and is always enabled. The event never seems to fire. The code is similar to the following:

Timer1_Timer()

Check the status of the I/Os on the PCI-7344 and update as necessary
If Input1 is 'on' the set Input1=True

End Sub

Command1_Click()

Do
DoEvents
Loop Until Input1=True

End Sub

For some reason the Timer1_Event never fires. This is a periodic occurence. The code may run fine 9 times out of 10.

Any ideas? I'm using Visual Basic 6.0 (SP5) on a Win2000 workstation. I have 2 PCI-7344 boards.

Thanks,

Ben
0 Kudos
Message 1 of 3
(2,981 Views)
Have yo tried doing some other event in the loop that does not involve the motion calls? This way we could determine if the issue is in the motion function call or somewhere in the VB code.
0 Kudos
Message 2 of 3
(2,981 Views)
Yes. Turns out I made a dumb mistake. I had cut and pasted around 75 lines of code into the timer event. Included within the code was another DoEvents. This is a no-no. Basically, it allows another Timer event to be serviced before the original gets done. Took it out and it works fine now (knock on wood).
0 Kudos
Message 3 of 3
(2,981 Views)