libpic170x
0.2
Ease of use library for PIC16(L)1705/1709 chips
|
Coarse timing library for measuring times in the background. More...
#include <stdlib.h>
#include <stdint.h>
Go to the source code of this file.
Classes | |
struct | Timer0 |
Functions | |
void | timer0_init (Timer0 *timer0) |
void | timer0_ih (Timer0 *timer0) |
Variables | |
Timer0 | pic170x_timer0 |
Coarse timing library for measuring times in the background.
Timer0 configures timer0 of a PIC16(L)F170x chip as continuous ms counter. The values of the continuous counter are stored in the global structure pic170x_timer0.
The counter requires the function timer0_ih to be called in the PIC's interrupt handler. The timer0_ih function will take care of updating the counter values according to the used _XTAL_FREQ settings. Please note that this library assumes that the configured frequency of the PIC does not change over time and remains constant while the program runs.
The timer is configured with a 256 prescaler, which leads to very high increments of the counter values (for a 8 MHz-configured chip it will be around 32-33 ms). This makes the timer values suitable for rough timing keeping only.
Definition in file timer0.h.
void timer0_ih | ( | Timer0 * | timer0 | ) |
void timer0_init | ( | Timer0 * | timer0 | ) |
Timer0 pic170x_timer0 |
Internal default pic170x_timer0 structure that will be used by the functions timer0_init() and timer0_ih() if no alternative is specified.