Hi Terry,
I would like to interface with some 5V devices and having the digital outputs work in open drain mode would do the trick. Is there anyway to accomplish this?
Good question. I'd never looked, but it appears the LPC1768 supports this; see chapter 8.4 in the LPC1768 manual (http://mbed.org/nxp/lpc1768/technical-reference/). The raw registers that control these functions are therefore LPC_PINCON->PINMODE_OD0 - LPC_PINCON->PINMODE_OD4.
We should be able to add this functionality to the mbed DigitalOut library too (something like pin.mode(OpenDrain)), so i'll put it on the list.
As an aside, (if i'm thinking straight), you should be able to hack a similar effect using DigitalInOut i.e. set the output to 0, and then switch the pin by switching between an input (high) or output (low).
#include "mbed.h"
DigitalInOut pin(p5);
int main() {
pin.output();
pin = 0; // setup output as low
while(1) {
pin.input(); // high
wait(0.25);
pin.output(); // low
wait(0.25);
}
}
This might be a quick way to test out the ideas.
Simon
I would like to interface with some 5V devices and having the digital outputs work in open drain mode would do the trick.
Is there anyway to accomplish this?
Thanks,
Terry