Hello All. I need an Open Collector line on my mega128 based board. Having read the datasheet I could not find any directions how to configure a port output to make it OC. Is it really impossible or I had missed a proper page? Reagards, Alex
AVR GPIO as open collector/drain
May 14, 2007
8 Replies
It's not possible; there are full totem-pole drivers on all pins. Use an external bipolar transistor.
Write 0 to the appropriate PORTx register bit. Use the appropriate DDRx direction register bit as the output.
VLV
By the way... why do you need it? If it is for I2C then look at the two-wire interface module. That's an exception to the "totem pole on all pins" statement.
- Thanks, Vladimir!
You are the first one I know who does care about the I2C multimaster mode. In my ~20 years of experience, I have never seen a system with more then one master on I2C. What is it?
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
formatting link
Well, to say the truth neither have I. But I was asked to consult 'pure' software developer about the possibility of implementation of bit-banging TWI protocol on their system, which had previously worked using TWI block. They use TWI for interboard communication. Necessary condition: 'no hardware changes'. Alex.
But is this MultiMaster ? - Doing Multi-Master (with the arbitration ) in SW is not going to be easy.... Tho if you have control on BOTH ends, you can probably cobble something together.
-jg
Forget the AVR and use a PIC !
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required