The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
A possible pattern of the method for preventing process collision of micro controller has been introduced in the foregoing embodiment. Below, another embodiment with 8 processes will be explained so that those skilled in the art can easily implement the present invention.
Whether process collision will happen at the least common multiple time of the foregoing 8 execution periods is determined (step 302). When process collision will happen at the least common multiple time of the 8 execution periods, the execution of the Ith process is delayed I times of the predetermined time (step 303). For example, the 1st process is delayed 1 ms, the 2nd process is delayed 2 ms etc. Next, whether the delay times of the foregoing 8 processes are equal to multiples of the greatest common divisor is determined (step 304). When it is determined that the delayed of the 6th process (5 ms) is equal to the greatest common divisor of said 8 execution period, the processes 6˜8 are respectively delayed 1 ms (step 305), here the 6th process is delayed 6 ms, the 7th process is delayed 7 ms, and the 8th process is delayed 8 ms so that process collisions can be avoided.
In overview, delays of predetermined time are used in the present invention to separate the rutine programs so that when the processor has to process at least two processes periodically, collision or interruption will not occur, and further, system panic can be prevented.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
| Number | Date | Country | Kind |
|---|---|---|---|
| 95120333 | Jun 2006 | TW | national |