I want a pin Low at V0 to high at 12V. while normally a pin Low 0v and high 5V.
use a transistor
Open drain it certainly has - you set it as a LOW output, and switch it between input and output as open drain and pulldown respectively.
The voltage has nothing to do with "open drain" - there is a protective diode preventing the output from exceeding Vcc by more than about half a volt.
Open drain it certainly has
Oh no it doesn't.
Look at the data sheet for the chip, there are no open drain outputs at all.
And 12V will smoke the IO pins, open drain or not.
Need to use an external transistor.
there is a protective diode preventing the output from exceeding Vcc by more than about half a volt.
Which will melt if it gets more than a few mAs or so of current through it.
Yes, Atmel recommends no more than 1mA, see top of page 4:
Atmel AVR182 Zero Cross Detector.pdf (95.1 KB)
uCs running hot is usually a good sign that an IO pin has been blown, and entire chip failure is usually not far behind.
Grumpy_Mike:
Look at the data sheet for the chip, there are no open drain outputs at all.
Then it cannot be used for I2C communications, which require open-drain outputs. ![]()
Then it cannot be used for I2C communications, which require open-drain outputs
No, you can use an output that is a logic zero coupled with a input for a logic one to get I2C data communications.
Grumpy_Mike:
No, you can use an output that is a logic zero coupled with a input for a logic one to get I2C data communications.
Precisely what I described in my earlier posting. ![]()
So technically, there are two open drain outputs, but they are not accessible as such, only for I2C:
22.2.2 Electrical Interconnection
As depicted in Figure 22-1, both bus lines are connected to the positive supply voltage through pull-up resistors.
The bus drivers of all TWI-compliant devices are open-drain or open-collector. This implements a wired-AND function which is essential to the operation of the interface. A low level on a TWI bus line is generated when one or more TWI devices output a zero. A high level is output when all TWI devices tri-state their outputs, allowing the pull-up resistors to pull the line high.
So basically no open collector outputs a user can actually use as a GPIO.
Nope - which is pretty much what you pointed out to start.