My program is to use Delphi program to step motor hair pulses. Each hairpin is a time-consuming loop. Each loop is triggered by a button, and I use Application.ProcessMessages in the loop. Because if you don't have this statement, when a loop is running, you don't have any other operations. If you can only have a loop run, multiple hairpin loops can't run at the same time, I click on a button to trigger the first Cycle. That is, when a loop is running, click the button to trigger the second loop, then the last loop will abort, until the second loop is running, the first one will continue to run, it seems to be interrupted.
So how do you implement multiple hairpin loops to run at the same time? I also used the delay program for many times in the hairpin:
Procedure delay (US: integer); // delayed program USVAR Start, TimeEnd: int64; begin QueryperFormanceCounter (start);
Repeat Application.ProcessMessages; QueryperFormanceCounter (TIMEEND); Until ((TimeEnd-start)> = US);
END;
Please advise! ! !