Need help with programming. Urgent!

Discussion in 'Embedded Systems and Microcontrollers' started by mimisalt, Aug 10, 2011.

  1. mimisalt

    Thread Starter New Member

    Aug 10, 2011
    5
    0
    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.
     
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Did you just copy & paste your homework assignment?
     
  3. mimisalt

    Thread Starter New Member

    Aug 10, 2011
    5
    0
    help pls. c programming
     
  4. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    Do you write always like that? Hard to read.

    I would not take the pain...
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
  7. mimisalt

    Thread Starter New Member

    Aug 10, 2011
    5
    0
    Its due on monday!

    Simple program for PIC16F877. maintain at 24V output
     
  8. mimisalt

    Thread Starter New Member

    Aug 10, 2011
    5
    0
    I need an assembly language for 8051
     
  9. blah2222

    Well-Known Member

    May 3, 2010
    554
    33
    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.
     
  10. Kermit2

    AAC Fanatic!

    Feb 5, 2010
    3,792
    945
    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. :)
     
  11. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    Here's the pseudo code for your project:

    Code ( (Unknown Language)):
    1. while(1)
    2. {
    3.     Vout = readOutputV();      // use A2D to get current output voltage
    4.     PWM = MagicEquation(Vout); // calc PWM setting to achieve proper voltage
    5.     SetPWM(PWM);               // use previous calculation to set the PWM
    6. }
    Rather simple once you break it down to the steps involved.
     
  12. PhilTilson

    Member

    Nov 29, 2009
    25
    3
    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
     
  13. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    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
     
  14. mimisalt

    Thread Starter New Member

    Aug 10, 2011
    5
    0
    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
     
Loading...