COUNTER PROGRAMMING: In my previous POST, we used the timers of the PIC18 to generate time delays. These timers can also be used as counters to count events happening outside the PIC 18. The use of the timer as an event counter is covered in this Post. When the timer is used as a timer, the PIC18's crystal is used as the source of the frequency. When it is used as a counter, however, it is a pulse outside the PIC 18 that increments the TH, TL registers. In counter mode, notice that registers such as TOC0N, TMR0H, and TMR0L are the same as for the timer discussed in the Previous post ; they even have the same names. T0CS bit in T0CON register for Counter Programming: Recall from the previous posts that the T0CS bit (Timer0 clock source) in the T0CON register decides the source of the clock for the timer. If T0CS = 0, the timer gets pulses from the crystal oscillator connected to the OSC 1 and OSC2 pins (Fosc/4). In ...
Your number one source to learn about PIC microcontroller. We're dedicated to providing you the basic but very best PIC controller tutorials, with an emphasis on simulation with Proteus.