|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 ![]() |
|
#2
|
|||
|
|||
|
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. Last edited by dcbrown : 06-03-2008 at 10:02. |
|
#3
|
|||||
|
|||||
|
Re: 4V - 5V signal on Digital Input
Quote:
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: Last edited by Ken Streeter : 06-03-2008 at 11:49. |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
||||
|
||||
|
Re: 4V - 5V signal on Digital Input
Quote:
An analog comparison will only take a couple lines of code. Code:
{
char a;
{
if (Get_analog_01() <= 800)
{
a = 0;
}
else
{
a = 1;
}
}
|
|
#6
|
|||
|
|||
|
Re: 4V - 5V signal on Digital Input
Quote:
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Digital out signal speed on off, almost like PWM but at max 60Hz | Generalx5 | Electrical | 2 | 27-03-2007 12:26 |
| Auton digital input | ten3brousone | Programming | 7 | 20-03-2005 22:23 |
| digital input question... | Kevin Karan | Programming | 9 | 12-04-2004 07:34 |
| counting digital input | CharlieWilken | Programming | 9 | 22-03-2004 19:56 |
| Robot Digital Input | Mike Norton | Technical Discussion | 5 | 16-01-2003 14:31 |