Can a PIC or preferably a PICAXE generate this waveform?

Discussion in 'Embedded Systems and Microcontrollers' started by Roderick Young, Nov 14, 2015.

  1. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    As part of a power supply, I would like to generate a PWM signal, say 10 or 20 kHz, with variable duty cycle. That's the easy part. That signal would go through a driver and turn on the main switch.

    But I would also like to generate another pulse of variable duration and delay, that is enclosed within the OFF time of the first signal. The second signal would turn on the synchronous rectifier(s).

    HPIM3105.JPG
     
  2. JohnInTX

    Moderator

    Jun 26, 2012
    2,347
    1,029
    On inspection, you probably could do something with a dual-PWM PIC and some clever interrupt handling.
    The upper trace is generated by a conventional ECCP PWM. Set it up to get an interrupt at the first rising edge of the top trace (the end of the top PWMs duty cycle and where you would load any changes to the first duty register, BTW).
    At that interrupt, use another timer to delay from the top leading edge to the bottom leading edge. That delay is the duty cycle count of the top PWM plus your fixed delay. From there, you could time W manually or launch the 2ed PWM for pulse width W. Stop that PWM at the 2ed leading edge of the top trace.
    If you only have one PWM, use it for the top trace and use another timer to 1)delay to the 2ed leading edge, reset it for the width and then 3)shut it down, all with interrupts.

    Rinse and repeat.
    Don't know about PICAXE. Some have single hardware PWM facilities but interpreting tokenized code from EEPROM is going to be kind of slow.
     
    Last edited: Nov 14, 2015
    atferrari and Roderick Young like this.
  3. MMcLaren

    Well-Known Member

    Feb 14, 2010
    759
    116
    Some more recent Microchip PIC devices like the 8-pin 12F1572, the 14-pin 16F1575, and the 20-pin 16F1579, offer multiple multi-mode 16-bit PWM outputs with phase/offset adjust and the ability to synchronize a 'slave' PWM output.

    Good luck on your project.

    Cheerful regards, Mike
     
    Last edited: Nov 15, 2015
    Roderick Young and JohnInTX like this.
  4. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    Two PWM's that I could control the phase relation between, would be a dream come true. No fussing with software, just set and forget. I'll look into it.
     
  5. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    Hola Rick

    Are d and W, fixed values?

    EDIT
    You said variable duration and delay. Sorry. /EDIT
     
  6. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    Now that I think about it, it could with a small and fixed delay, even a delay of 0 (in that case, the delay would be accomplished by external analog components). But variable duration would be an absolute requirement.
     
  7. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,648
    764
    OK Roderick, given the delay is fixed, what would regulate the duration "W"? Would it be the same that regulates the PWM's duty cycle?

    In other words, any fixed relationship between DC and W?
     
  8. Roderick Young

    Thread Starter Member

    Feb 22, 2015
    408
    168
    There is a relationship, but it's complicated. W depends on the duty cycle, and input voltage, the output voltage, and whether the converter has crossed from discontinuous to continuous mode. If W is too short, efficiency suffers somewhat, and the equalization of voltage across output cells (batteries or supercapacitors) may suffer, too. If W is too long, all kind of bad things happen, including ringing, and loss of regulation. That's why I would like to use a processor to compute W. There are power supply chips that do this already, but I was unable to find one that does everything I want.
     
Loading...