Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Using a PIC to generate radio freq. PWM

Status
Not open for further replies.

Mosaic

Well-Known Member
I am doing an experiment to build a 400W RF class E amplifier at about 4Mhz.
This means controlling the duty cycle of the pulses governs the amplifier efficiency.

I am considering the 48Mhz 18F25J50
https://ww1.microchip.com/downloads/en/DeviceDoc/39931d.pdf

Given the PWM Period:
PWM Period = [(PR2) + 1] • 4 • TOSC•(TMR2 Prescale Value)
It seems that a PR2 of 2 is the max I can get for a 4Mhz PWM drive.
Which just gives 0,25,50,100% PWM settings. Not much control.

The alternative is to make a one shot timer which is driven by a 4Mhz click line and then alter PWM by altering the one shot duration.

Any suggestions on this?
 
You may get a better resolution using compare but the interrupt will need to be coded cleverly..

Have a look at it as it kinda is the one shot solution.. BUT!! the CCP pin is toggled for you.. You need to reset the timer it the interrupt though!
 
I didn't see a link in your post:
You may get a better resolution using compare but the interrupt will need to be coded cleverly..

Have a look at it as it kinda is the one shot solution.. BUT!! the CCP pin is toggled for you.. You need to reset the timer it the interrupt though!


But I did up this spice sim to allow for duty cycle mgmt over the range of interest. For the feedback control I'm thinking about averaging the miller current spikes (not sure how yet) thru the FET source and also the current coming thru the class E RFC then creating a ratio from the RFC current pulse of perhaps 80% as a control ref for an opamp to adjust the DC% via biasing the PNP in the sim.
xtal osc.png

class E amp.png


Note the 'loss' current spike where the FET switches while there's still charge in the output capacitance.
class E amp-miller.png
 

Attachments

  • xtal sig osc.asc
    3.6 KB · Views: 242
Last edited:
Although timer 2 is clocked at 1/4 of the 48MHz, the PWM module uses 2 extra bits for PWM so you will have 12 different values to work with.

Edit, A value of 2 in PR2 only gives you 3 values not four. The two extra bits make it 12.

Mike.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top