Subject:
|
RE: converting binary to integer
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 3 Jun 1997 12:53:07 GMT
|
Original-From:
|
killkie <COREYFRO@DEEPWELL.COMstopspam>
|
Viewed:
|
1359 times
|
| |
| |
that works... but try the finger method... it helps you under stand the concept by giveing you something tangible to work with
----------
From: Jeff Keyzer
Sent: Tuesday, June 03, 1997 10:38 PM
To: Keith the wonder wookie
Cc: Handy Board
Subject: Re: converting binary to integer
At 12:40 AM 6/4/97 -0400, you wrote:
> I am reading four digital inputs and I need a way to convert those four
> bits into a decimal number. Is there an easy way to do it. Thanks.
>
> Keith
>
> Keith Soldavin
> kas219@email.psu.edu
> http://www.personal.psu.edu/kas219/
>
>
Multiply each bit by 2^n, where n is the "place" of the number. Then add
the products together. For example...
1011 = 1*2^0 + 1*2^1 + 0*2^2 + 1*2^3 = 11
The "zero" place is the one furthest to the right, and you work left from
there.
--------------------------------
Jeff Keyzer
UCSD EE Major
jkeyzer@ucsd.edu
http://sehplib.ucsd.edu/~jkeyzer/
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|