Hello
I'm using pwm with led.
When i put zero to OCR0A (for instance) the led don't go down : there is a few light...
Somebody have an idea?
Notice that the led is connected direct to avr (with a R).
Thanks
Hello
I'm using pwm with led.
When i put zero to OCR0A (for instance) the led don't go down : there is a few light...
Somebody have an idea?
Notice that the led is connected direct to avr (with a R).
Thanks
I think the usual suggestion is to use the COM bits to complement the PWM output then set OCR0A to the maximum value.
Oh, Clawson, still the first to answer...
Thanks, i will try this.
Ok it's efficient (sorry for my english)
With ocrx=255 : no light.
But i don't understad why...
Could you explain...
This problem come with 8bit counter (counter0 of attiny2313)
No problem with the other counter...
Could you explain...
This problem come with 8bit counter (counter0 of attiny2313)
No problem with the other counter...
If you are using the full range of the counter, the 8-bit counter will be high 1 of 256 counts--about 1/2% You get some light. On the 16-bit, 1/65536 or about 0.0015%. You can't see that light.
But i don't understad why...
I'm pretty certain that the data sheet explains that OCR = 0 will actually still give a pulse of one counter clock, which, as The Usch explained, will still be visible using 8 bit PWM.
You can, of course, trap the zero condition and set the output pin for normal operation in this case.
However, Cliff's solution of inverting the sense is probably easier.
thanks...
could I use this principle at the and of your example for getting PWM to 0 when the AD convertion is at the lowest level in my source?
regards,
Bert
could I use this principle at the and of your example for getting PWM to 0 when the AD convertion is at the lowest level in my source?
Sigh--I see another request; I answered in that thread as well as above.
sigh, I can ask questions where I like I think?
I can ask questions where I like I think?
Not necessarily, if the topic is repeated the thread gets locked. Anyway your question in 9 was to a thread that has been unused for 6/7 years and unlikely to get a reply from the OP.
Anyway your question in 9 was to a thread that has been unused for 6/7 years and unlikely to get a reply from the OP.
What is interesting, John, as I mentioned it is probably the same situation. And OP did dig out the related thread. The "sigh" is that in both this thread and the other one the probable solution was outlined -- inverted PWM. Yet Be_logic seems to want more.
Well, there is the method mentioned in #7 that Arduino uses -- if you set the
"Analog" output to 0 it disables the timer pin and sets the PORT bit to 0.
--Mike
Hi, hopefully the code snippit is enough so when I change adc = ADC_MIN; into adc=0, lowest PWM value is the same, so not zero.
Where can I find an example about #7 trapping the zero condition.
The trouble is that the potentiometer on de AD input has a lowest value of 60 Ohm and at that lowest position PWM should be zero.
Sorry I could not send the code snippit with <> because I don't know how to use it.
e.g. It's impossible to paste in the window that opens after klicking <>
regards,
Bert
You were told in this thread and the other one how to do it -- use inverted PWM. I'd guess it has been brought up many times. It was also explained why it happens. Yes, if you care to you can turn the timer/PWM off and on. Often/usually it is simpler just to use inverted PWM if there is no hard requirement for 100% duty.
I'd guess it has been brought up many times.
https://www.avrfreaks.net/forum/... with a datasheet quote
https://www.avrfreaks.net/forum/... with links to prior
https://www.avrfreaks.net/forum/...
https://www.avrfreaks.net/forum/... see title -- applicable?
https://www.avrfreaks.net/forum/... good explanation in #6
...
Many thanks!
Bert