Hello! I am using the timer1 outputs PB1 and PB2 on the mega 328 Baby Orangutan to generate pwm outputs. For some reason I cannot get more than 1.25 V out of them. I looked at the M1 and M2 outputs and they are 5 V, and when I use PB1 and PB2 as digital outputs they can go up to 5 V.
My thought is there may be something wrong with my BabyO. I used virtually the same code on my SVP-324 and it worked fine. So, before I chalk it up to some hardware fault, is there actually some setting with the pwm and Timer 1 that could limit 255 = 1.25 V (when Vin = 5V)? I am using a non inverted fast pwm with no prescalar and 8 bit timer. Thanks!
Are you measuring 1.25 V with a multimeter? Do you have an oscilloscope you can use to see what is happening on those outputs?
Please note that Timer1 is a 16-bit timer, unlike Timer0 and Timer2, which are 8-bit, so 255 is not necessarily the maximum count of the timer. I suspect you might be using a 10-bit PWM mode that counts up to 1023 (0x03FF), which would produce a 25% duty cycle with an output compare value of 255, and that would explain why you measure 1.25 V (25% of 5 V) on the pins. Could you post the code you are using to set up Timer1?
Seriously, you nailed it in one try! I had it in 10 bit mode. You saved my last vestiges of sanity. Thank you for taking the time for my problems!
I’m glad I could help. Thanks for reporting back!