pic_timer1.c File Reference

Include dependency graph for pic_timer1.c:

Functions

void timer_setup_1 (uns8 prescaler_setting, uns16 timer_start_value)
 Setup timer 1 with starting values.
void timer_start_1 ()
 Start timer 1.
void timer_stop_1 ()
 Stop timer 1.

Variables

uns16 timer_1_start_value = 0

Function Documentation

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);   // turn off timer if it was on so we can get it set up
00046     clear_bit(t1con, TMR1CS);   // Internal instruction cycle clock
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);  // Turn on timer 0 interrupts
00054 }

void timer_start_1 (  ) 

Kicks off timer 1.

00056                      {
00057     tmr1h = timer_1_start_value >> 8;
00058     tmr1l = timer_1_start_value & 0xff;
00059     set_bit(t1con, TMR1ON);
00060 }

void timer_stop_1 (  ) 

Stops timer 1.

00063                     {
00064     clear_bit(t1con, TMR1ON);
00065 }


Variable Documentation


Generated on Fri Aug 19 09:08:53 2011 for Pic Pack Library by  doxygen 1.6.1