About Timing
Previous Top Next

About Timing

When using GP3EZ to drive the GP3 from your PC, you should be aware of  certain timing limitations inherent in the Windows operating system. In general, you can expect any timing performed by the GP3 hardware to be quite accurate (controlled by the ceramic resonator on the board). However, timing performed by the PC (such as the delay in an "After" milliseconds condition) will be subject to the PC's timing accuracy.

For long delays on a fast PC, this isn't usually a big deal. However, trying to do fast or precise timing will pose a problem. A common task, for example, is to control a continuous rotation RC servo. To do this you have to send a pulse near 1.5 mS in length about every 20mS or so.

Since the GP3 can produce pulses, the 1.5mS pulse isn't a problem. However, the 20mS delay is problematic. Tests on a 2.5Ghz AMD dual core processor running XP showed that even simple instructions with no delays take about 60mS to execute. This is partially because of the GP3's serial interface speed and partially because the program is sharing time with other Windows programs, etc. What's more is that on the PC it is hard to assure exact timing. So even the 60mS will vary depending on a variety of factors.

However, if you compile the code, the length of time drops dramatically. For example, a simple two step script that toggles an output bit produces a square wave with a period of 155mS on the same test hardware. The same script when compiled produces a 230uS square wave (that is 0.23mS). That speed, of course, is independent of the PC since the GP3 doesn't use the PC to run compiled code.