To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 5171
5170  |  5172
Subject: 
Re: digital and analog port on HD
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Mon, 18 Jan 1999 17:10:22 GMT
Original-From: 
Will Bain <[willbain@cs.]NoSpam[umt.edu]>
Viewed: 
749 times
  
phillip chia wrote:
I want to use the digital port as an  analog port input.  How should I
convert the digital port to analog in using programming way ?

A digital port can't have the capability of an analog port, since it has
only one bit of information with which to work.  (A 256-value analog
port has eight bits.)  You could perhaps hook an analog sensor up to a
digital port using some sort of thresholding circuit (a voltage
divider/transistor combination), but you would have to preset the
threshold to a constant value, and the HB would then see it as a digital
device.

if possible, how to convert the analog port to digital port also using
programming .

Using an analog port as a digital, on the other hand, is easy.

if (analog (12) <127)
{ ..............
  .............
}

The above will not work (although I don't know what sort of error you
will get).

else if  (digital (3)  == 1)
{  .................
  '..................
}

The above would work ok, although it's a little more terse to say:

     else if( digital( 3 ) ) {...}

It's the same as "if( analog( 3 ) > 127 )".  It basically just throws
away the other seven bits of information.

Note that with an 8-bit D-A convertor circuit, one ought to be able to
use one analog port for up to eight digital inputs at a time.

-- Will
                                          , ,
        __@_/             \_@__           |/
          |                /__,           o             @_/
          )\              )              ( \            (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson,                   There's a fine line between fishing and
Will Bain,                    just standing on the shore like an idiot.
& Tatoosh                                               --Steven Wright



Message is in Reply To:
  digital and analog port on HD
 
Hi, I want to use the digital port as an analog port input. How should I convert the digital port to analog in using programming way ? I do not quite understand the explanation on the technical manual handout. if possible, how to convert the analog (...) (26 years ago, 17-Jan-99, to lugnet.robotics.handyboard)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR