Subject:
|
Re: Analog I/O as Digital I/O
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 27 Sep 1999 12:54:00 GMT
|
Original-From:
|
Michael N Rosenblatt <mr4@andrew.cmu%Spamless%.edu>
|
Viewed:
|
960 times
|
| |
| |
Also, the "digital(int p)" extends to the analog ports too. When used
with a port that is analog in hardware, it just uses 127 as a threshold
value to return 1 or 0 (note below 127 returns true).
See page 22 in the HB manual.
However, with this method, you lose the advantage of setting your own
thresholds which, as Will stated, may be important depending on your
application.
Michael Rosenblatt
Carnegie Mellon University
On Mon, 27 Sep 1999, Will Hein wrote:
> > Can the analog input lines be used as a digital input lines (if there is
> > no requirement of analog input)? Because, these lines are connected to
> > the port E of 68hc11, then what are modifications required in the code?
>
> Since the analog inputs read voltage levels, you should be able to just plug
> in any switch or 5-0volt input directly. To read the values, use the analog
> command, and in theory you should only get two possible values, 255 for
> +5volts, and 0 for 0 volts. Depending on if your inputs are driven logic
> versus switches, you may need to threshold these values and consider
> anything above maybe 200 to be a logic high and anything below 50 to be a
> logic low. But if you are using precisely 5 volts and 0 volts, or an open
> and closed switch, than the extreme values should be accurate.
> -Will Hein
> Carnegie Mellon University
>
|
|
Message is in Reply To:
| | Re: Analog I/O as Digital I/O
|
| (...) Since the analog inputs read voltage levels, you should be able to just plug in any switch or 5-0volt input directly. To read the values, use the analog command, and in theory you should only get two possible values, 255 for +5volts, and 0 for (...) (25 years ago, 27-Sep-99, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|