Quote:
|
Originally Posted by Aalfabob
My first question is, are there any counters built into the main unit?
If there is, how would i access it?
|
The edu_clock example that does what you want can be found here:
http://kevin.org/frc/. It's for the EDU-RC, but should be easy to adapt to the FRC-RC. This is the header of clock.c:
Code:
/*******************************************************************************
*
* TITLE: clock.c
*
* VERSION: 0.3 (Beta)
*
* DATE: 18-Dec-2003
*
* AUTHOR: R. Kevin Watson
* kevinw@jpl.nasa.gov
*
* COMMENTS: This demonstrates the use of a timer and associated interrupt.
* In this example we'll setup a timer to generate an interrupt
* every millisecond (= 1000Hz rate). In response to this interrupt,
* the microcontroller will execute a specific piece of code called
* an interrupt handler (see user_routines_fast.c). This interrupt
* handler will simply increment the global variables "msClock" and
* "Clock". High-level user code can then access these variables to
* create sophisticated state machines and highly accurate sequencers.
* We'll just keep the time.
*
*
********************************************************************************
*
* Change log:
*
* DATE REV DESCRIPTION
* ----------- --- ----------------------------------------------------------
* 14-Dec-2003 0.1 RKW Original
* 16-Dec-2003 0.2 Accuracy bug: Changed the value of PR2 to 249 (was 250)
* 18-Dec-2003 0.3 Fixed 25 hour/day and 366 day/year bugs
*
*******************************************************************************
Let me know if you have any trouble.
-Kevin