Subject:
|
Re: Analog I/O as Digital I/O
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 27 Sep 1999 09:43:26 GMT
|
Original-From:
|
Will Hein <wfh@AVOIDSPAMandrew.cmu.edu>
|
Viewed:
|
792 times
|
| |
| |
> 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 has 1 Reply: | | Re: Analog I/O as Digital I/O
|
| 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 (...) (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
|
|
|
|