PAUSE for a variable time? Using MAX and MIN
In my program I have LC as a variable word ranging from 0 to 57000. It is the mainloop counter
In a subroutine I want to pause a variable amount of time in the 0 to 5000 part of the mainloop counts. I have tried to use:
pause 0 min 5000-LC
in other words, if LC is 5000 to 57000 don't pause at all. and between 0 and 5000, pause for a proportional length of time.
I think my pause pause and min statement is missing some syntax?
Any hints please?
Re: PAUSE for a variable time? Using MAX and MIN
5000-57000 will give negative number
Maybe you want to use ABS(5000-LC)
so:
Code:
a=abs(5000-LC)
a=a min 5000
Pause a
might help?
But then I am not very sure about the maths to calculate the needed delay.
Ioannis
Re: PAUSE for a variable time? Using MAX and MIN
Does this provide the functionality you want?
Code:
IF LC < 5000 THEN
PAUSE (5000 - LC)
ENDIF
Re: PAUSE for a variable time? Using MAX and MIN
Thank you Ioannis and Henrik, both your suggestions would be suitable for me. I apologise for posting this amateur question. In my defence, I had just started a section a code when the grandchildren arrived and that put a sudden stop to it . . . . . :)