Hi, I must receive a data from a temperature sensor and for do this I must set the port 4.7 in open drain mode.how I can put the port in open drain mode??
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi, I must receive a data from a temperature sensor and for do this I must set the port 4.7 in open drain mode.how I can put the port in open drain mode??
Usually, open drain does mean NO internal pullup. However:
init:
PxSEL&=~BITx;
PxREN|=BITx; or PxREN&=~BITx; (with/without pullup)
PxOUT&=~BITx;
output low:
PxDIR |= BITx;
output high:
PxDIR &= ~BITx;
The content of PxOUT is kept even if you switch from input to output and does not affect the mechanics when dir is input.
Usually open drain means, that one needs a pullup somewhere. If there is no external pullup, then the internal one might be of good use.
Yes. Depending on the purpose, it should be central, controlled by one peer on tthe bus or each has its own internal pullup.HardyGriech said:Usually open drain means, that one needs a pullup somewhere.
The usual case is one external pullup, as then the peers do not need to sink more and more current the more peers are on the bus. (think of an I2C bus with 127 slaves, each of them ahs its pullup on. Whew, you'll need really strong outputs to sink that to GND.
Yes. Yet it is dangerous to 'just do it' without considering the pitfalls.HardyGriech said:If there is no external pullup, then the internal one might be of good use.
**Attention** This is a public forum