Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Inversion of the digital IO pins (http://www.chiefdelphi.com/forums/showthread.php?t=35394)

ConKbot of Doom 24-02-2005 11:42

Inversion of the digital IO pins
 
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

Re: Inversion of the digital IO pins
 
Quote:

Originally Posted by ConKbot of Doom
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

Re: Inversion of the digital IO pins
 
Quote:

Originally Posted by Alan Anderson
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

Re: Inversion of the digital IO pins
 
Quote:

Originally Posted by Ryan Cumings
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

Re: Inversion of the digital IO pins
 
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

Re: Inversion of the digital IO pins
 
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
Code:

#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...


All times are GMT -5. The time now is 04:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi