10.07.2015 Views

CF2 API Reference (PDF) - Persistor Instruments Inc

CF2 API Reference (PDF) - Persistor Instruments Inc

CF2 API Reference (PDF) - Persistor Instruments Inc

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>CF2</strong> <strong>API</strong> <strong>Reference</strong>RTCElapsedTime -- Read the elapsed time (us)Description:Prototype:Inputs:Returns:Notes:Read the elapsed time in microsecondsulong RTCElapsedTime(RTCTimer *rt);rt is a pointer to an RTCTimer struct that is preallocated and ready to be filled.Returns the elapsed time in microseconds.Because internally the real time clock can only measure time in units of ticks, the timer isinternally counted as an integer number of ticks then normalized to microseconds. Because onetick is approximately 25 µsecs and the calling overhead of the functions that interact with thesecounters is at least 20 µsecs, the timers have an effective resolution of no less than 55 µsecs.RTCElapsedTimerSetup -- Setup and start an elapsed timer (us)Description:Prototype:Inputs:Notes:Tells the real time clock to set up and start an ascending counter. The timer will immediatelybegin counting up from zero in microseconds. Once RTCElapsedTimerSetup returns, use thefunction RTCElapsedTime with the same RTCTimer struct to watch the counter.void RTCElapsedTimerSetup(RTCTimer *rt);rt is a pointer to an RTCTimer struct that is preallocated and ready to be filled.See the Elapsed and Countdown Timers description at the top.RTCGetTime -- Get both seconds and ticksDescription:Prototype:Inputs:Returns:Notes:The real time clock maintains two registers. One that keeps ticks (1/40000'ths of a second (forapproximately 25 µsec resolution) and one that keeps seconds.ulong RTCGetTime(ulong *seconds, ushort *ticks);seconds is a pointer to a ulong into which the current seconds counter will be placed.ticks is a pointer to a ushort into which the current ticks count will be placed.Returns a ulong containing just the seconds count. This is useful when you do not wish to createplaceholding variables.If either or both of the pointers are NULL, the function will not write into the base of memory, itwill ignore the parameter and fill the other one, or if both are NULL, it will simply return theseconds count. See RTCSetTime for UNIX epoch note.RTCSetTime -- Set both seconds and ticksDescription:Prototype:Inputs:RTCSetTime loads values into the ticks and seconds registers that are provided in the argumentto the function. For standard operation these values should reflect the number of seconds andthe number of ticks since the UNIX epoch which is midnight Jan 1, 1970, although there is norestriction that forces this to be true. RTCSetTime can be called regardless of whether the realtime clock is running or stopped. If the clock is running, RTCSetTime will set the time and keepthe clock running, as could be expected. If the clock is stopped, for instance if you wish to setthe clock based on an external event, RTCSetTime will load the given values into the registersand then when/if the clock is started, it will continue to count from the values loaded.void RTCSetTime(ulong secs, ushort ticks);secs is a ulong that contains the value intended for the seconds register of the Real Time Clockticks is a ushort that contains the value intended for the ticks register of the Real Time ClockPERSISTOR<strong>Instruments</strong> <strong>Inc</strong>.50 of 84<strong>CF2</strong> <strong>API</strong> <strong>Reference</strong>7/19/2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!