pic_timer1.h File Reference
Timer 1 support.
More...
Go to the source code of this file.
Detailed Description
Define Documentation
#define TIMER1_PRESCALER_1_TO_2 0b00010000 |
#define TIMER1_PRESCALER_1_TO_4 0b00100000 |
#define TIMER1_PRESCALER_1_TO_8 0b00110000 |
#define TIMER1_PRESCALER_OFF 0b00000000 |
Function Documentation
void timer_1_callback |
( |
|
) |
|
When a timer 1 interrupt occurs, after handling the interupt and timing issues, this callback function is executed. You will need to define this subroutine in your code, otherwise linking will fail.
void timer_handle_1_isr |
( |
|
) |
[inline] |
Call this routine in your interrupt subroutine to automatically service timer 1 interrupts if they have occursed.
00094 {
00095 uns16 start_value;
00096 if (test_bit(pir1, TMR1IF)) {
00097 #ifdef _PIC16
00098 start_value = tmr1l + timer_1_start_value + 8;
00099 tmr1h = start_value >> 8;
00100 tmr1l = start_value & 0xff;
00101 #else
00102 start_value = tmr1l + timer_1_start_value + 8;
00103
00104 tmr1h = start_value >> 8;
00105 tmr1l = start_value & 0xff;
00106 #endif
00107 timer_1_callback();
00108 clear_bit( pir1, TMR1IF );
00109 }
00110 }
void timer_setup_1 |
( |
uns8 |
prescaler_setting, |
|
|
uns16 |
timer_start_value | |
|
) |
| | |
Turns off timer 1, sets prescaler setting and start value (which will be loaded on each reset).
00043 {
00044
00045 clear_bit(t1con, TMR1ON);
00046 clear_bit(t1con, TMR1CS);
00047 #ifdef _PIC18
00048 set_bit(t1con, RD16);
00049 #endif
00050 t1con &= 0b11001111;
00051 t1con |= prescaler_setting;
00052 timer_1_start_value = timer_start_value;
00053 set_bit(pie1, TMR1IE);
00054 }
Stops timer 1.
00063 {
00064 clear_bit(t1con, TMR1ON);
00065 }
Variable Documentation