2.3.1 Time

The measurement of time relies on an internal clock of the MainPic. The PIC sends a packet of data periodically to the USB transceiver at a frequency of 4 kHz (see Appendix C). One of the variables included in the packet is the CycleCount. It is a 32-bit number that increases one unit every time the MainPic completes a loop. Therefore, one unit of CycleCount represents a lapse of time of 1/4 kHz = 250 $ \mu $s. The host computer performs the following operation to calculate the time,

$\displaystyle [\mathrm{Time}]=[\mathrm{CycleCount}]\,/\,\mathrm{Frequency}$ (2.28)

where [Time] is the time in seconds and Frequency is the calibration factor (Frequency = 4000). Nevertheless, it is useful to perform a check with an oscilloscope. The frequency can be directly measured by connecting the probe of the oscilloscope to any wire of the parallel bus that communicates the three PICs in the main board (see Fig. 2.12). If the instrument works properly, the signal of the wire must be periodic with a frequency of 4 kHz. The error in the calibration of time directly depends on the error of the internal clock of the MainPic. The relative error of the oscillation frequency (i.e., $ \Delta f/f_0$) is lower than 50 ppm, which is more than enough for the applications that we are interested in.

JM Huguet 2014-02-12