Hi all, using arduino nano board I setup Fast PWM mode 14 with timer 1 to D9 (PB1) as noninverted output and D10 (PB2) as inverted output of the same frequency/duty period. But the external hardware needs to disconnect the internal pull-up resistor for D10 (PB2). The other output at D9 (PB1) is ok and the pull-up resistor can stay enabled. The specific question is how to disable the internal pull-up resistor for D10 (PB2) without interfering the PWM and the other output at D9. The more generic question is looking at the datasheet of ATMega328P page 89, figure 14.5 Alternate port functions, on the next page Table14.2 and on page 94 Table 14-5. Overriding Signals for Alternate Functions in PB3...PB0, could somebody explain with example how to program PUOE signal with SPE • MSTR(inverted) and PUOV with PORTB2 • PUD(inverted). What is the meaning of the dot and + sign and how the signals could be produced with example.
With pinMode()
EDIT - in your case, set or clear the associated port control bits... are you asking how to mask the bits?
I doubt you will notice the effect of the internal pull-up. The pins are output and driven by a buffer that is far stronger than the internal pull-up when the output is high.
Yes, it will affect the external circuit as it is transistor connected to higher voltage. If the internal pull-up is enabled it is about 35k to +5V, which is comparable to the external 47k and enough to open the transistor which is not the desired effect. What I am asking is how to program the Overriding Signals for Alternate Functions in PB3...PB0 with example as of Table 14-5. on page 94 of the datasheet.
What I am asking is how to program the Overriding Signals for Alternate Functions in PB3...PB0 with example as of Table 14-5. on page 94 of the datasheet of ATMega328P. PUOE and PUOV signals
To turn off a pullup on an input, you'd use digitalWrite, at least that's how it is done on the AVR architecture.
No that method is deprecated
Reference, please?
In my case both pins are output with already programed PWM
I don't usually tit-for-tat but my proof is that you will not find that method anywhere in the current documentation. Precisely because it is AVR specific. AFAIK it dates from a time when pinMode() didn't have that functionality...
Not even here?
The pull ups are ~30k. Why does it matter when the pins are output? Actually, I think the hard GPIO logic should do this automatically.
https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/ATmega48A-PA-88A-PA-168A-PA-328-P-DS-DS40002061B.pdf the link to the datasheet which I mentioned.
That is a warning, it's on the digitalWrite page. It's not mentioned as a feature. In fact there it says,
" It is recommended to set the pinMode()
to INPUT_PULLUP
to enable the internal pull-up resistor."
getting into unrelated questions is not helpful, if somebody understands the table and know how to use it please let provide an example
I'm answering your questions. Well, I was. I don't like thread bosses. Good luck with your project.
Edit - you haven't posted any code.
yes you was answering about inputs, here I have outputs already programmed with PWM, so I can't touch that way
The way things are supposed to work, alternate functions automatically enable/disable GPIO logic, in other words over-ride it. So I'm not convinced that the pullup configuration even has any effect in the mode you are using.
You haven't posted your code. The forum guidelines recommend it:
It has always been my understanding that those signals are internally controlled. That is, if you configure an IO for PWM, those signals are configured by the PWM configuration.
This is also stated in the datasheet. Unfortunately I have a different cersion of the datasheet, it's just above the table "generic description of overriding signals for alternate functions".
exactly