Skip to content

microchip-pic-avr-examples/pic18f47q10-cnano-tmr0-clk-out-mcc

Repository files navigation

MCHP

PIC18F47Q10 Using TMR0 in 8-bit Mode and to Generate an Output Signal

Objective

This repository contains an example of MCC-generated source code for TMR0 as described in TB3285 - Getting Started with Timers/Counters on PIC18 document from Microchip.

This example describes how to configure TMR0 in 8-bit mode, using LFINTOSC as clock source.
A GPIO pin is configured as output and a 125 Hz signal is generated on the GPIO pin (RC2) using the Peripheral Pin Select (PPS).
The code was generated using MPLAB Code Configurator.

Related Documentation

Software Used

Hardware Used

Setup

The PIC18F47Q10 Curiosity Nano Development Board is used as the test platform.


The following configurations must be made for this project:

  • Clock
    • Oscillator Select: HFINTOSC
    • HF Internal Clock: 1 MHz
    • Clock Divider: 1
  • TMR0
    • TMR0 Enabled
    • Clock Prescaler: 1:1
    • Postscaler: 1:1
    • Timer mode: 8-bit
    • Clock Source: LFINTOSC
    • Synchronization: disabled
    • Timer interrupt: enabled
  • Watchdog Timer: disabled
  • Low-voltage Programming: enabled
Pin Configuration
RC2 Digital Output

Operation

  1. Connect the board to the PC.

  2. Open the pic18f47q10-cnano-tmr0-clk-out-mcc.X project in MPLAB® X IDE.

  3. Set pic18f47q10-cnano-tmr0-clk-out-mcc project as main project. Right click on the project in the Projects tab and click Set as Main Project:

  4. Select the PIC18F47Q10 Curiosity Nano in the Hardware Tool section of the project settings:

  • Right click on the project and click Properties;
  • Select the PIC18F47Q10 Curiosity Nano (click on the SN) in the Hardware Tool tab and then click OK:
  1. Program the project to the board: right click on the project and click Make and Program Device:

Result:
RC2 pin - Channel 0 (black) in the screenshot below
Hardware Setup

Summary

This project is an illustration for a basic use case based around TMR0.

About

This repository provides a MCC-generated code example for using TMR0 in 8-bit Mode with clock output. A signal will be generated using TMR0 on the output RC2 pin.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published