4-7
4.2.5
Timer Units
The two timers present on the V104 can be used for a variety of applications. The timers run at a maximum
of 1/6 of the processor clock rate, which determines the maximum resolution that can be obtained.
These timers are controlled and configured through a mode register that is specified using the software
interfaces. The mode register is described in detail in chapter 9 of the NEC V25 User’s Manual.
The timers can be used to time execution of your user-defined code by reading the timer values before and
after execution of any piece of code. For a sample file demonstrating this application, see the sample file
timer.c in the directory tern\v25\samples\ve.
The specific behavior that you might want to implement is described in detail in chapter 9 of the NEC V25
User’s Manual.
void timer0_init
void timer1_init
Arguments: unsigned char mode, unsigned int md0, unsigned int tm0
Return values: none
The argument mode is the value that you wish placed into the TMC0/TMC1 mode registers for configuring
the two timers.
The argument md0 is the modulo timer count and t0 is the timer count.
void timer0_interrupt
void timer1_interrupt
Arguments: unsigned char i, void interrupt far (* timer0_isr)()
Return values: none
The argument i enables the interrupt and (*timer0_isr)() or (*timer1_isr)() points to the interrupt service
routine. The interrupt service routine is called whenever count 0 is reached, with other behavior possible
depending on the value specified for the control register.
4.2.6
Other library functions
On-board supervisor MAX691 or LTC691
The watchdog timer offered by the MAX691 or LTC691 offers an excellent way to monitor improper
program execution. If the watchdog timer (J9) jumper is set, the function hitwd() must be called every 1.6
seconds of program execution. If this is not executed because of a run-time error, such as an infinite loop or
stalled interrupt service routine, a hardware reset will occur.
void hitwd
Arguments: none
Return value: none
Resets the supervisor timer for another 1.6 seconds.
void led
Arguments: int ledd
Return value: none
Turns the on-board LED on or off according to the value of ledd.