wazzco:
I have all pull-up resistors disabled ( in the MCUCR register, the PUD bit has been set) BUT I want to be able to override this global setting for every pin apart for a short time during a subroutine.
setting the PUOExn register high allows the value set in register PUOVxn (0 or 1) to override any value set in the PUD.
And I need to find the way to set these registers (PUOExn and PUOVxn).
Well, you can't do it.
The PUOE and PUOV thingies are not bits that you can set in a register somewhere. They are signals that are generated under certain conditions for certain pins. In particular, they control pull-ups for alternate I/O functions (not general-purpose digital read/write functionality).
For example for the '2560 Port E (Table 12-16 and 12-17)
There are no signals for bits 7, 6, 5, 4, 3 ,2 that can cause PUOE or PUOV to be asserted for those pins. (Normal DDR functionality holds, and can not override the setting of the global PUD bit.)
On the other hand, If you have TXEN0 bit set in the USR0B register, the pin associated with bit 1 will be an output pin (DDOE is set and DDOV is 1, overriding the normal DDR register), and nothing you can do can enable the pull-up (PUOV is 1 and PUOE is zero) ---makes sense, right?
Then...
If you have the RXEN0 set in the UCSR0B register, PUOE for this bit is set, the PUOV signal will enable the pull-up resistor if you have written a '1' to bit zero of the PORTE register and have not written 1 to the PUD bit. (In other words you can't override it.)
Certain other alternative function bits can override the PUD bit (For bits associated with the pins used for JTAG inputs the pull-ups will be enabled when the JTAGEN fuse is programmed, regardless of the PUD bit value.)
I can't think of any other I/O bits of any kind for which the pull-ups can be enabled in spite of the PUD bit. (I could be wrong about that, but I am certain that for the vast majority of I/O pins, the pull-ups can not be enabled when PUD is set. Well pretty certain.)
Regards,
Dave