Tutorial 2: Timer0 Timer mode

In Timer0 mode and with no prescalor the PIC16C5X increments the internal TMR0 register every internal clock cycle or at a frequency of Fosc/4. In this example, the value of TMR0 is written to PORTB so the internal incrementing of Timer0 can be visualised

Download FEATURE12C5X_Tutorial2.zip and unzip into folder <your path>\Tutorial 2

Filename Version Description
tut2.pjt 1.0 MPLAB Project
tut2.asm 1.0 PIC12C5XX Assembler code
tut2.hex 1.0 Precompiled HEX
tut2.lst 1.0 Precompiled LST
tut2.vbb 1.0 Virtual Breadboard simulation

Running the Simulation

Open tut2.vbb and press RUN.

Code Walk Through

Note: The asm file is compiled only for the pic16C54 but will run on any of the PIC16C5X devices. However when loading the file, Virtual Breadboard will detect the list = p16C54 line in the .lst source code and will warn that there is a processor mismatch. The warning does not effect the execution of the code.

 

Features Demonstrated

TRISB/PORTB

TIMER0 Timer Mode

Components Used

PIC12C508

PIC12C509

PIC12C518

PIC12C519

LED8