Tutorial 4:  Timer 0 External Counter with variable Prescalor

An external clock pulse increments Timer0 in counter mode. The current Timer0 prescalor is shown on PortB and the current Timer value is displayed on PORTC.

Download FEATURE877_Tutorial4.zip and unzip into folder <your path>\Tutorial 4

Filename Version Description
tut4.pjt 1.0 MPLAB (2.3) Project
tut4.asm 1.0 PIC16F877 Assembler code
tut4.hex 1.0 Precompiled HEX
tut4.lst 1.0 Precompiled LST
tut4.vbb 1.0 Virtual Breadboard simulation

Running the Simulation

Open tut4.vbb and press RUN. The counter will immediately begin incrementing with the current prescalor displayed on PORTB and the Timer0 displayed on PORTC.

Code Walk Through

 

 

Features Demonstrated

TRISA/PORTA

TRISB/PORTB

A4/T0CKI

Timer0 Counter Mode

Timer0 Interrupt

Timer0 Prescalor