3.3. PIC16 C Hardware Timers
• Counter/timers
• Capture and Compare
• Timer interrupt
The PIC 16F877 has three hardware timers built in: Timer0 (originally called RTCC, the real-time counter clock), Timer1, and Timer2. The principal mode of operation of these registers are as counters for external events or timers using the internal clock. Additional registers are used to provide Capture, Compare, and Pulse Width Modulation (PWM) modes. The CCS timer function set is shown in Table 3.5
Action | Description | Example |
---|---|---|
TIMERX SETUP | Set up the timer mode | setup_timer0(RTCC_INTERNAL|RTCC_DIV_8 ); |
TIMERX READ | Read a timer register (8 or 16 bits) | count0=get_timer0(); |
TIMERX WRITE | Preload a timer register (8 or 16 bits) | set_timer0(126); |
CCPX SETUP ... |
Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.