Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   4V - 5V signal on Digital Input (http://www.chiefdelphi.com/forums/showthread.php?t=65504)

tdlrali 06-03-2008 09:11

4V - 5V signal on Digital Input
 
We have an input signal that is at 4V when it is low, and at 5V when it is high. How could we bring the voltage down so that we can read it in as a digital input?

And no, analog inputs are not an option :D

dcbrown 06-03-2008 09:49

Re: 4V - 5V signal on Digital Input
 
The first thing that comes to mind is a simple level triggering opamp circuit? For example LM339s or LM139s? Set up a resistor divider so that 4.1v is Vref, apply your 4v-5v to Vin, Vout should be ~0v if Vin is less than 4.1v and ~5v is greater than 4.1v...

See National Semi AN-74.pdf application note for more info.

Ken Streeter 06-03-2008 10:20

Re: 4V - 5V signal on Digital Input
 
Quote:

Originally Posted by tdlrali (Post 713579)
We have an input signal that is at 4V when it is low, and at 5V when it is high. How could we bring the voltage down so that we can read it in as a digital input?

And no, analog inputs are not an option :D

Do you mind my asking why analog inputs are not an option? Are you already using all of the analog inputs on the controller?

If you need to use a digital input, the suggestion of using an LM339 (4 comparators in a package) or an LM393 (2 comparators in a package) is a good approach.

Data sheets can be found online:

tdlrali 06-03-2008 14:51

Re: 4V - 5V signal on Digital Input
 
Thanks guys, I'll look into those options. The only reason we don't want to use analogs is because we're really just looking for on vs. off, and the additional sampling required for using an analog input is overkill.

billbo911 06-03-2008 15:30

Re: 4V - 5V signal on Digital Input
 
Quote:

Originally Posted by tdlrali (Post 713687)
Thanks guys, I'll look into those options. The only reason we don't want to use analogs is because we're really just looking for on vs. off, and the additional sampling required for using an analog input is overkill.

It may be overkill, but if the custom circuit's output does not operate such that it meets the designed parameters of the RC, then you need to adjust your approach.
An analog comparison will only take a couple lines of code.

Code:

{
char a;
{
if (Get_analog_01() <= 800)
{
a = 0;
}
else
{
a = 1;
}
}


eugenebrooks 06-03-2008 19:06

Re: 4V - 5V signal on Digital Input
 
Quote:

Originally Posted by tdlrali (Post 713687)
Thanks guys, I'll look into those options. The only reason we don't want to use analogs is because we're really just looking for on vs. off, and the additional sampling required for using an analog input is overkill.

Building custom circuitry, when the an analog input can get your
on-off state is overkill. We ran out off digital inputs this
year and needed one more. We wired the switch to a
pullup resistor and an analog input, coded to set a variable to 0 when
the voltage was below 2.5 volts and to 1 when the voltage was
above. It worked just fine.

Eugene


All times are GMT -5. The time now is 10:43.

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