Need help with programming. Urgent!

Thread Starter

mimisalt

Joined Aug 10, 2011
5
I JUST NEED TO MAINTAIN THE OUTPUT VOLTAGE AT 24V

Circuit diagram of the proposed system
Figure 10 shows that power stage included switch SW where it may consists of one or more parallel connected power MOSFET, a fast switching type flyback diode D, an inductor L wound onferrite core with air gap to prevent core saturation, and output capacitor C.The controlling stage consists of a PIC16F877 microcontroller with built-in analog-to-digitalconverter (ADC), a power MOSFET driver, and a voltage divider. The control strategy based on theflow chart in Figure 8 will be written and load into the microcontroller. Voltage divider resistors R1and R2 will divide the output voltage to a suitable voltage range which is acceptable by the built-inADC in the microcontroller. PIC16F877 will then perform calculation based on the control algorithmand produce a PWM signal with a set of duty cycle. The frequency of the PWM is programmable byPIC16F877. The PWM signal is then transmitted to power MOSFET in power stage through a power MOSFET driver to perform on and off state.The PIC16F877 microcontroller unit features an eight-bit, successive approximation ADC, used by the control program to measure signals required for the power flow control. The 10-bit resolution isadequate for the proposed design. Also, it features two PWM outputs with program-controlled dutycycle and 208.3 kHz maximum frequency when driven by the 20 MHz clock of the unit. The firstPWM output is used to control switch SW in boost converter while the second PWM output can beused to control switch in auxiliary circuit such as zero voltage switching circuit and zero currentswitching circuit to reduce switching losses in boost converter. This type of microcontroller waschosen because it has the necessary features for the proposed design such as built-in ADC, PWMoutputs, eight-bit architecture, high clock rate, low power consumption and low cost.In order to calculate the value for
Lmin and Cmin
, the switching frequency will be set to thelowest value of 20 kHz. The rating of the proposed converter will be 100W and 24V output. Byreferring to (3),
Lmin maximum will occur at k = 0.333 and the calculated value will be 2.1 mH. As thedesired output voltage ripple factor is below 1%, the calculated value of C min will be 687μF.PIC16F877 microcontroller uses 5V as its reference voltage for the ADC. Therefore, the ADC shouldsense less than 5V from the voltage divider. The converter switching frequency and the inductancevalue is compromised between the converter’s efficiency, cost, power capability and weight.For the control system, PIC16F877 microcontroller will produce a PWM signal pulse train withvarying duty cycle in the range of 0 to 1.0. Practically, duty cycle for boost converter is only in therange of 0 to 0.75. This is due to instability of boost converter (Mahmood et al., 2008). Therefore, therange of the input voltage for the boost converter is in the range of 6V and 24V. If the voltage detectedis not within the range, PIC16F877 microcontroller will put the whole system into sleep mode.In order to control the duty cycle, voltage divider divides the output voltage of 24V to PICreference voltage of 5V because ADC in PIC16F877 microcontroller is unable to operate under highvoltage. The resistance of R1 and R2 should be high enough in order not to produce high power losses,I2R and affect the overall converter performance. Furthermore, as the reference voltage of PIC16F877microcontroller is 5V, the PWM signal pulse train with the amplitude of 5V is unable to switch the power MOSFET on and off. Therefore, a current sink and source power MOSFET driver is needed tooperate the power MOSFET as a switch working in the active region of its I-V characteristic.
 

Attachments

blah2222

Joined May 3, 2010
582
No one is going to write this for you. Show us what you have done, and we will go from there.

We do have to abide by YOUR deadlines.
 

Kermit2

Joined Feb 5, 2010
4,162
Perhaps if you want to PAY someone to do it for you. Business could be done. PM me for the bank routing number. I think I could supply you with the needed program for a low 4 figure sum.

Remember, you would still be just as clueless to the required processes and lack the knowledge of how it operates, but at least you could get your project completed and receive your passing grade.

The price will only get higher the next time though. :)
 

ErnieM

Joined Apr 24, 2011
8,377
Here's the pseudo code for your project:

Rich (BB code):
while(1)
{
    Vout = readOutputV();      // use A2D to get current output voltage
    PWM = MagicEquation(Vout); // calc PWM setting to achieve proper voltage
    SetPWM(PWM);               // use previous calculation to set the PWM
}
Rather simple once you break it down to the steps involved.
 

PhilTilson

Joined Nov 29, 2009
131
I think what the previous correspondents are trying (not too subtly!) to point out is that forums like this are designed to help people along with difficulties that arise while they are attempting to solve a problem, and not to be simply handed the problem and told "Do that for me!"

Have you done anything at all towards this project? Do you have some work that others could look over and correct? Remember, God - and this forum - helps those who help themselves!

Phil
 

someonesdad

Joined Jul 7, 2009
1,583
Wait! I've worked on your problem for a couple of days and got a neat solution. I just printed it out and was going to send it to you. Oh, crap! The dog ate it!!! :p
 

Thread Starter

mimisalt

Joined Aug 10, 2011
5
CSEG AT 0000H
LJMP START
CSEG AT 0003H
LJMP EXIT_0
CSEG AT 000BH
LJMP TIMER_0
CSEG ST 0013H
LJMP EXIT_1
CSEG AT 001BH
LJMP TIMER_1
CSEG AT 0036H
START: CLR P2.0 ;Clear bit (P2.0 = 0)
MOV SP,#5FH ;load 5FH into SP
CALL Init_Timer
CALL Init_Interrupt
CALL Init_ADC
CALL Init_RAM
SETB IE.7
ADC : CLR P3.6 ;Clear bit (P3.6 = 0)
CLR P3.0 ;Clear bit (P3.0 = 0)
CLR P3.1 ;Select IN0
SETB P3.6 ;P3.6 = 1
NOP ;wait for a few microseconds
NOP
NOP
NOP
CLR P3.6 ;Clear bit (P3.6 = 0)
NOP ;wait for a few microseconds
NOP
NOP
HERE : JB P3.2,HERE ;jump if bit = 1
NOP ;wait for a few microseconds
NOP
SETB P3.7 ;P3.7 = 1
NOP ;wait for a few microseconds
NOP
MOV A,P1 ;Get bit from port
NOP ;wait for a few microseconds
NOP
CLR P3.7 ;Clear bit (P3.7 = 0)
RET



this is what i've done so far. the ADC part only
 
Top