Posted: Wed Oct 06, 2021 10:38 pm Post subject: Timer1 set for 8bit PWM -Pin always +5V
Dear All,
I want to control some power MOSFET in a H-Bridge.
The gate of the N-Mosfet is to be controlled by a PWM via a push-pull circuit.
For some reason the PWM outputs are set to +5V. Powerful enough to drive a LED.
This is independent from the value in the OCR1x registers.
Her the code:
Posted: Thu Oct 07, 2021 5:40 pm Post subject: Re: Timer1 set for 8bit PWM -Pin always +5V
autoguider wrote:
As I cannot turn the PWM voltage down I create short circuit.
Mind to explain?
Turning down which voltage gives a short circuit?
There's no such as a PWM-voltage other than the supply voltage for PWM, and PWM means full supply voltage or full GND.
If duty cycle of a PWM is 50%, then half the time its fully supply voltage and half the time it's off, this drives most DMMs nuts.
If this should tell that different PWM-A/B values create a short circuit, then you need to think about what control signals the lower and upper side expects for being active.
In case you supply two PWM-signals which power on lower and upper side at the same time, you truly have a shortcut.
Always 'break before make'.
Beside, the code you show is more than sloppy, I think you can do better.
Code:
enableinterrupts' PWM-Timer start
This does not start a timer and why enabling interrupts, if there are none?
What happens after the last line after 'start timer1', happy turnover with reboot?
Dear MWS,
thanks for your comments.
I just got some new processor chips.
Now the code works. The PWM voltage behaves as it should. The MOSFETS are controlled in the proper way.
In my code example I tried to cover any sources of disturbance. That is why I enabled the interrupts.
Now the issue is solved- by replacement of the hardware.
With the new chip the UART makes problems which was not the case with the previous chip
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum