Question
How to get the deadband between 2 PWM signals using Arduino Uno. The code below is how I generated 2 PWM signals. // Synchronize PWM
How to get the deadband between 2 PWM signals using Arduino Uno. The code below is how I generated 2 PWM signals.
// Synchronize PWM on channels outputs OC1A, OC1B at 20Hz and OC3A at 40Hz
void setup() {
pinMode(10, OUTPUT); // Set digital pin 11 as an output
pinMode(9, OUTPUT); // Set digital pin 12 as an output
pinMode(5, OUTPUT); // Set digital pin 5 as an output
GTCCR = _BV(TSM) | _BV(PSRSYNC); // Halt and synchronize the timers
TCCR1A = _BV(WGM11) | _BV(COM1A1) | _BV(COM1B1); // Enable the PWM outputs OC1A, OC1B on digital pins 11 and 12
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS11) | _BV(CS10); // Set fast PWM and prescaler of 64 on timer 1
ICR1 = 12499; // Set the timer 1 frequency to 20Hz
OCR1A = 6250; // Set the timer 1, channel A duty-cycle to 50%
OCR1B = 6250; // Set the timer 1, channel B duty-cycle to 50%
TCNT1 = 0; // Set the timer 1 count to 0
GTCCR = 0; // Let the timers free run simultaneously...
}
void loop() {}
Step by Step Solution
3.41 Rating (148 Votes )
There are 3 Steps involved in it
Step: 1
Answer To calculate the deadband between these two signals you can modify the loop function to read ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started