Fast PWM on Pins 9 and 10 of Arduino Uno

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;
}

I don’t really understand your question completely, but the UNO doesn’t have a DAC, so that may be contributing to your disappointment.

Do you have an oscilloscope? You could look at the output pins to check the PWM waveform.

I know it does not have a true DAC. The PWM output was around 0.5 V, but now it seems to be at 0.67 V with the same input value for 0CR1A.

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.

Do you know what PWM is ?

The output voltage doesn’t change, it’s either 0 or 5V (Vcc) on and off - depending on the duty cycle you specify.

Yeah I do actually. Not very hard to make a low pass filter to turn pwm into a similar DC voltage

Even when the duty cycle is at 100%, the output should be a continuous 5 Volts. It is not.

Well, I guess it’s about time we saw your schematic.

Your code produces signals with duties 10.1 and 60.6% on my LA, which exactly matches your OCR1x values.
So look for your error.

How is this measured?

Where and how defined the pins?

A multimeter put on DC Voltage

Pins 9 and 10 respectively. Above the set up

It is also being read in by a nFR Microcontroller to test different points on a gauge.

Which Arduino is your spare? Nano has a reverse polarity diode in series with USBV that drops 0.3 ~ 0.5V so you only get 4.5 ~ 4.8V on 5V pin.

Not reading off of 5V Pin. They are both Arduino Unos.

I downloaded the code into Wokwi and am getting an output on pin 9 of 6.4μs.
The PWM period is 64μs.
So yeah, 0.5V out of 5V max.

Output on pin 10 is 38.75μs.

Interesting. Wonder why the output is different on my spare...

See the post #9
I already wrote to you the same as @dlloyd: there are no problems with the code, it works correctly.

I think that your voltage measurements are wrong.