I am currently implementing fast PWM mode on an Arduino Uno. I have the set up code attached. I am getting an output near 0.5 V which is expected from 0CR1A when set to 102. I downloaded the code into my spare Arduino and am getting an output near 0.67 V. Is the DAC (pwm) output on my spare burnt?
void setup() {
Serial.begin(9600);
pinMode(pwmPin_sensor, OUTPUT);
pinMode(pwmPinDash, OUTPUT);
/* Set up 10 bit resolution PWM on arduino */
TCCR1A =
(1 << COM1A1) | (1 << COM1B1) |
// Fast PWM mode.
(1 << WGM11);
TCCR1B =
// Fast PWM mode.
(1 << WGM12) | (1 << WGM13) |
// No clock prescaling (fastest possible
// freq).
(1 << CS10);
OCR1A = 102;
OCR1B = 620; // 18 Volts
// Set the counter value that corresponds to
// 1023 (10 bit)
ICR1 = 0x03ff;
}
For how I have the timers and pwm set up, with an input of 0CR1A = 0, the output voltage should be ~ 0 Volts. For an input of 1023 (TOP value) it should be ~ 5 Volts. For an input of around 100, the output SHOULD be 0.5 V, but it is way higher. When I input 1023, the output is 4.34 Volts. I cannot even get an output of 5 Volts anymore.