Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Changing PWM period from ADC - PIC16F684

Status
Not open for further replies.

Sicknote

Newbie level 1
Joined
May 17, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,292
Hi,
As part of a uni project I need to program a pic to vary the PWM period and duty cycle in conjunction with 2 potentiometers.

I have set up both ADC channels and have checked they're both functioning properly.
The PWM is set up and running.
One of the pots works fine with the ADC to provide a new value for CCPR1L and thus change the duty cycle however I am not sure how to program it to change the period, once the PWM is running.

Once the result of the 2nd ADC has been saved in a register, can this then be moved, at any point, in to the PR2 register (for PWM period) or are there certain conditions that must be set before PR2 can be given a new value?
Also, how do I get the mark:space ratio to remain unchanged so that the 'ON' time increases proportionally with the Period time and maintaining the current duty cycle?

Any help would be greatly appreciated.

Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top