Code Monkey home page Code Monkey logo

picdew / pic18f47q10-cnano-tmr0-8bit-cmp-int-mcc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microchip-pic-avr-examples/pic18f47q10-cnano-tmr0-8bit-cmp-int-mcc

0.0 1.0 0.0 6.41 MB

This repository provides a MCC-generated code example for using TMR0 in 8-bit Mode with Periodic Interrupt. TMR0 will generate a compare interrupt every 100 ms, using LFINTOSC as clock source. A GPIO pin is toggled each time an interrupt occurs.

Makefile 38.87% C 58.82% Shell 2.30%

pic18f47q10-cnano-tmr0-8bit-cmp-int-mcc's Introduction

MCHP

PIC18F47Q10 Using TMR0 in 8-bit Mode with Periodic Interrupt

Objective

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


This example describes how to configure Timer0 in 8-bit mode and to generate a compare interrupt every 100 ms using LFINTOSC as clock source.
A GPIO pin (the development board’s on-board LED) will be configured as output and toggled each time the interrupt occurs.
Additionally, the main clock will use a separate clock source (HFINTOSC) and Timer0 will run asynchronously from the main clock. 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:16
    • Postscaler: 1:1
    • Timer mode: 8-bit
    • Clock Source: LFINTOSC
    • Synchronization: disabled
    • Timer period: 100 ms
    • Timer interrupt: enabled
  • Watchdog Timer: disabled
  • Low-voltage Programming: enabled
Pin Configuration
RE0 (LED0) Digital Output

Operation

  1. Connect the board to the PC.

  2. Open the pic18f47q10-cnano-tmr0-8bit-cmp-int-mcc.X project in MPLAB® X IDE.

  3. Set pic18f47q10-cnano-tmr0-8bit-cmp-int-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:

Demo:
Hardware Setup

Summary

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

pic18f47q10-cnano-tmr0-8bit-cmp-int-mcc's People

Contributors

mariusnicolae avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.