Hi To Everyone!
I am starting to work with Arduino for my project. I have to design the control loop including the PWM signals for an Half Bridge for Induction Cooking. At the first glance I would like to implement the two complementary signals for the high side and the low side plus the dead time and two interrupts for over voltage/current and over temperature.
I Start to work on the modulation and I am a little bit confuse. I am wondering if someone can give me some helpful advice.
(Assuming an Uno)
If you use timer1 (pins 9 & 10) or timer2 (pins 11 and 3) you already have
phase-correct PWM mode enabled, so all you have to do is set the two
pins at slightly different values and invert one of them:
void setup ()
TCCR1A = (TCCR1A & 0x0F) | 0xB0 ; // set pin 10 inverted
int val = 100 ;
int dead = 2 ;
analogWrite (9, val) ;
analogWrite (10, val+dead) ;
void loop ()
Will give 8us deadtime with the PWM at its normal prescale of 1/64,
since 16MHz/64 = 250kHz, or 4us steps, and dead=2 steps.
To get higher frequency PWM add
TCCR1B = (TCCR1B & 0x0F8) | 0x01 ; // full speed 16MHz clock
larger values than 0x01 give different prescale dividers