Sunday, October 16, 2016

Binary is as easy as 1, 10, 11

Definition

Binary - In mathematics and digital electronics, a binary number is a number expressed in the binary numeral system or base-2 numeral system which represents numeric values using two different symbols: typically 0 (zero) and 1 (one).https://en.wikipedia.org/wiki/Binary_number

Notes

  • BASE 2 Counting method only uses 0 and 1
  • One binary digit is called a bit
  • Two digits are called a crumb, four digits are called a nibble, and eight digits are called a byte
  • Lower Case letters start with 011xxxxx
  • Upper Case letters start with 010xxxxx
  • When counting, range 0-1, carry the 1 (i.e. 00000000, 00000001, 00000010, 00000011, 00000100, 00000101, 00000110, 00000111, 00001000, 00001001, 00001010 ...)
  • 1+1=10

Converting binary (BASE 2) to decimal (BASE 10)

A byte can be represented as:

n·2^7 | n·2^6 | n·2^5 | n·2^4 | n·2^3 | n·2^2 | n·2^1 | n·2^0

OR

n·128 | n·64 | n·32 | n·16 | n·8 | n·4 | n·2 | n·1*

*Any nonzero number raised to the zero power is equal to one (i.e., n^0=1). This concludes that all nonzero numbers raised to the zero power are equivalent because they all equal 1. Note that it is any nonzero number, since 00 is undefined.

Conversion Examples

10 = 1·2^1 | 0·2^0 = 1·2 + 0·1 = 2
111 = 1·2^2 | 1·2^1 | 1·2^0 = 1·4 + 1·2 + 1·1 =7
1011 =  1·2^3 | 0·2^2 | 1·2^1 | 1·2^0 = 1·8 + 0 + 1·2 + 1 = 11

Converting binary (BASE 10) to decimal (BASE 2)

2^4 2^3 2^2 2^1 2^0
16 8 4 2 1

Use the value in the second row to count to the value--you can use each value no more than 1 time (since we count 0..1). For example, we want to convert 22 to binary. To do this we need:

(1 x 16) + (0x8) + (1x4) + (1x2) + (0x1)

10110 = 22

Letter to ASCII to Binary Character Table

LetterASCII CodeBinaryLetterASCII CodeBinary
a09701100001A06501000001
b09801100010B06601000010
c09901100011C06701000011
d10001100100D06801000100
e10101100101E06901000101
f10201100110F07001000110
g10301100111G07101000111
h10401101000H07201001000
i10501101001I07301001001
j10601101010J07401001010
k10701101011K07501001011
l10801101100L07601001100
m10901101101M07701001101
n11001101110N07801001110
o11101101111O07901001111
p11201110000P08001010000
q11301110001Q08101010001
r11401110010R08201010010
s11501110011S08301010011
t11601110100T08401010100
u11701110101U08501010101
v11801110110V08601010110
w11901110111W08701010111
x12001111000X08801011000
y12101111001Y08901011001
z12201111010Z09001011010

References 





No comments:

Post a Comment