[PIC:] Request help with CCP & PMSC modules

Dwayne Reid <[email protected]> Sun, 7 Dec 2025 14:28:39 -0700
Newsgroups gmane.comp.hardware.microcontrollers.pic
Message-ID <CAM6OUcHxjTEDrcpoNt7XZyD0aGoN2mE2tnPAsMpzNeWfTHynMw@mail.gmail.com>
---------- Forwarded message ---------
From: Dwayne Reid <[email protected]>
Date: Sun, Dec 7, 2025 at 12:36 PM
Subject: Request help with CCP & PMSC modules
To: Microcontroller discussion list - Public. <[email protected]>


Good day to all.

I am working on a project that accepts an input sine-wave signal in the
range of 300Hz - 750 Hz.  The original request was to simply scale the
frequency but has since been changed to adding an offset of about 185 hz to
the incoming frequency.  Output can be a simple square wave.

I am using a PIC16F1782 which has two CCP modules and two PMSC modules
available.  I have a tiny bit of experience with the PMSC module using it
as a simple  fixed-frequency PWM generator.  This worked well.

I have almost zero experience using the CCP modules.  Using one of the CCP
modules to measure the incoming period is easy.  But using the second CCP
module to generate a different output frequency seems difficult because
there is only one TMR1 module.

I had considered using PMSC1 for the frequency output.  The only problem is
having to calculate the Rising Edge & Falling Edge values - these depend on
the incoming frequency.

Suggestions greatly appreciated!

Many thanks!

dwayne
-- 
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
https://mailman.mit.edu/mailman/listinfo/piclist