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.

change PWM duty cycle with ADC (PIC16f877) to generate constant output voltage

Status
Not open for further replies.

switimira

Member level 1
Joined
Dec 5, 2009
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,523
Hi

I'm currently making a boost converter. The output need to be 12V constantly. I already built the circuit and managed to boost the voltage. Now i need a feedback loop in order for circuit to maintain the output voltage. I hope someone will help since i really new for this. Really need some basic coding to control output voltage via varying pwm. My input would be a battery. The program that i used is picbasic.
 

You have a train of pulses going to your switching device. You found a particular frequency and duty cycle in order to provide 12V to your load.

To automate it, suppose the duty cycle makes the load voltage go high (say 12.1 V). Your pic detects this. Program it to reduce the duty cycle a bit.

If load voltage goes low (say 11.9V), then program it to increase the duty cycle slightly.

You'll need to wait a few cycles each time after adjusting the duty cycle.

You'll want to find the right amount to increment and decrement the duty cycle. Too great a change will cause overshoot (swinging wildly above and below 12V).
 

Thanks BratheRad,
how i'm supposed to do so?I mean is it using a voltage divider for the loop? can u give me a simple coding?
 

Yes, you must run the output voltage to a voltage divider. The output voltage will rise higher than supply +. You must not let the pic be exposed to a level greater than specs permit.

Or it is typical to use a sense resistor somewhere.

Such as:

2791154300_1352192196.png


The sense resistor should have a low ohm value, yet which is just high enough to develop a usable volt reading for the pic.

- - - Updated - - -

Your On time might be a variable named 'Duty_On'.
The Off time might be 'Duty_Off'.

Set a counter to zero. Pull the bias control pin high. Go through a repeating loop, incrementing the counter each time. When the counter reaches Duty_On, exit the loop. (As an alternate, use the pic's onboard timer variable.)

Set the counter to zero. Pull the bias control pin low. Go through a repeating loop, incrementing the counter each time. When the counter reaches Duty_Off, exit the loop.

After going through the above loops a few times, read the sense resistor. If sensed V is high, reduce Duty_On. If sensed V is low, increase it.

As for Duty_Off, you may want to increase it or decrease it correspondingly.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top