View Full Version : Inversion of the digital IO pins
ConKbot of Doom
24-02-2005, 11:42
I was hoping to use an external EEPROM to store data for our autonomous routine, it uses an I2C interface, but I have code written to bit-bang, so that is ok, but here is my question. I know the pins are inverted as an input, since when they are low, you get a 1 in software, and when they are high, you get a 0. But are they inverted as outputs too?
Thanks
Alan Anderson
24-02-2005, 12:48
I was hoping to use an external EEPROM to store data for our autonomous routine, it uses an I2C interface, but I have code written to bit-bang, so that is ok, but here is my question. I know the pins are inverted as an input, since when they are low, you get a 1 in software, and when they are high, you get a 0. But are they inverted as outputs too?
Thanks
They're not inverted in my experience, as either input or output. You might be thinking of the fact that they're internally pulled up to 5 volts, so a switch to ground reads as a logic 1 when it's open and a logic 0 when it's closed.
Ryan Cumings
24-02-2005, 13:01
They're not inverted in my experience, as either input or output. You might be thinking of the fact that they're internally pulled up to 5 volts, so a switch to ground reads as a logic 1 when it's open and a logic 0 when it's closed.
I thought that a pull up floated high which meant that it will always read as a logic 1 unless you ground the signal pin
Alan Anderson
24-02-2005, 13:37
I thought that a pull up floated high which meant that it will always read as a logic 1 unless you ground the signal pin
You thought correctly. As I said, closing the switch to ground yields a logic 0.
Matt Leese
24-02-2005, 16:06
A pullup does not imply inversion. It just means that when you leave it floating, you will get a logic one on the input. If you have an input connected to it that will pull the input down, then you will get a logic zero as the input.
Matt
ConKbot of Doom
25-02-2005, 12:41
Nevermind, limit switches, use OPEN and CLOSED, not a bit test... bah sorry
Its been a long 6 weeks... (*mutters on about being designer, team leader, and programmer...*)
I thought that they made it so that when the switch was closed, the bit read 1, and when it was open it read 0.
in user_routines.h
#define OPEN 1 /* Limit switch is open (input is floating high). */
#define CLOSED 0 /* Limit switch is closed (input connected to ground). */
I guess I won't have to modify my programs after all...
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.