Hi,
I am halfway through a project which involves using a dc to dc converter to boost the voltage from a solar panel to a constant 100V.
I have designed and successfully built the boost converter and have written a simple PWM code to boost 17V (rated output voltage from panel) to 100V:
#include <p16f877.h>
void main(void)
{
trisc = 0x00;
portc = 0x00;
pr2 = 0x18; //sets PWM period
ccpr1l = 0x14; //sets PWM duty cycle to 82%
t2con = 0x05; //enables timer 2 modules and sets the TMR2 prescale value to 4.
ccp1con = 0x2C; //Enables PWM mode
}
This is working fine.
Now I want to write additional code so i can send the correct PWM to the switch so i can maintain 100V output whatever the input voltage/light level i.e (input voltage 0-20V) - which will involve adjusting the duty cycle according to the input voltage. As i'm a beginner to programming it has been suggested to me that i use a control circuit consisting of op amps to reduce the input voltage range to 0-5V and feed this into the A/D input of the pic that I am using (PIC16F877A).
This is where I am stuck:
After reading the datasheet, I still don't understand how the A/D would convert the input voltage and where the 8bit digital number is stored? hence where i can call it from. Is the A/D simple to set-up?
Do you think the above method would work?
I'm really struggling with this feedback code, so any help or advice on the best way to implement a solution to what i'm trying to achieve would be greatly apreciated.
Thanks
elec123
I am halfway through a project which involves using a dc to dc converter to boost the voltage from a solar panel to a constant 100V.
I have designed and successfully built the boost converter and have written a simple PWM code to boost 17V (rated output voltage from panel) to 100V:
#include <p16f877.h>
void main(void)
{
trisc = 0x00;
portc = 0x00;
pr2 = 0x18; //sets PWM period
ccpr1l = 0x14; //sets PWM duty cycle to 82%
t2con = 0x05; //enables timer 2 modules and sets the TMR2 prescale value to 4.
ccp1con = 0x2C; //Enables PWM mode
}
This is working fine.
Now I want to write additional code so i can send the correct PWM to the switch so i can maintain 100V output whatever the input voltage/light level i.e (input voltage 0-20V) - which will involve adjusting the duty cycle according to the input voltage. As i'm a beginner to programming it has been suggested to me that i use a control circuit consisting of op amps to reduce the input voltage range to 0-5V and feed this into the A/D input of the pic that I am using (PIC16F877A).
This is where I am stuck:
After reading the datasheet, I still don't understand how the A/D would convert the input voltage and where the 8bit digital number is stored? hence where i can call it from. Is the A/D simple to set-up?
Do you think the above method would work?
I'm really struggling with this feedback code, so any help or advice on the best way to implement a solution to what i'm trying to achieve would be greatly apreciated.
Thanks
elec123