Reputation: 179
I am implementing an isolated boost converter. I have to generate a PWM signal for the switches given in the figure below. I have difficulty understanding the pattern. The PWM pattern is as follows: At the beginning all four switches are kept on, then switches 1, 4 are kept on while switches 2, 3 are closed as shown in the figure. Please, help me to get started on this problem. How can I generate this type of PWM? Then, at a later time the PWM should be shifted with some duty cycle time for Q2, Q3. I am confused. How can I add some delay or shift the PWM? I am using a pic18f45k22 micro controller, and the programming tool is MikroC.
Upvotes: 1
Views: 2156
Reputation: 34585
I don't know whether the length of the "off" time is critical, but suppose the mark/space ratio is 1:3 as suggested in your timing diagram,
Q1,Q4 1011101110111
Q2,Q3 1110111011101
Configure a free-run timer to interrupt at one quarter of your required cycle period. At each interrupt it performs one of four tasks in sequence, such as this pseudo code
void timer_interrupt() {
static int operation = 0; // is initialised only once
clear_timer_status(); // acknowledge the interrupt
switch (operation) {
case 0: Q14_off();
break;
case 1: Q14_on();
break;
case 2: Q23_off();
break;
case 3: Q23_on();
break;
}
operation = (operation + 1) % 4; // advance to next operation
}
If you want a smaller mark/space ratio, you can do it in a similar way. Suppose you want a ratio of 1:7 represented by
Q1,Q4 101111111011111110
Q2,Q3 111110111111101111
now in this case the timer rate should be one eighth of the cycle, but not every interrupt will have an action
void timer_interrupt() {
static int operation = 0; // is initialised only once
clear_timer_status(); // acknowledge the interrupt
switch (operation) {
case 0: Q14_off();
break;
case 1: Q14_on();
break;
case 4: Q23_off();
break;
case 5: Q23_on();
break;
}
operation = (operation + 1) % 8; // advance to next operation
}
There are other ways to do this: such as an array of output bit patterns that you look up as pattern[operation]
Upvotes: 1