Subject:
|
Re: converting binary to integer
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Wed, 4 Jun 1997 05:38:21 GMT
|
Original-From:
|
Jeff Keyzer <JKEYZER@spamlessUCSD.EDU>
|
Viewed:
|
1299 times
|
| |
| |
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/
|
|
Message is in Reply To:
| | converting binary to integer
|
| 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 (URL) (27 years ago, 4-Jun-97, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|