Skip to content

Getting Started with Timers/Counters on PIC18. The TMR1 is configured in gate single pulse and toggle combined mode.

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f47q10-cnano-tmr1-frequency-measuring-mcc

Repository files navigation

MCHP

PIC18F47Q10 Using TMR1 Gate to measure frequency

The PIC18F47Q10 features Timers with Gate Control. This example shows how to use the TMR1 configured in gate single pulse and toggle combined mode. It with sample a full period of a signal. A GPIO pin will be configured as input and it will be connected to a periodical signal.

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:

Pin Configuration
RB5 Digital Input

Demo:

Run the code in debug mode. Pin RB5 is configured as digital input. A periodical signal needs to be applied to this pin. Set a breakpoint inside "TMR1_GATE_ISR()". The measured frequency will be stored in the variable called "value". The code will stop at the breakpoint when the signal period has ended.

Hardware Setup