單晶片控制 Design with Microcontrollers
單晶片控制 Design with Microcontrollers
INTRODUCTION TO
COMPUTING
Decimal and Binary Number
Systems
Human beings use base 10 (decimal)
arithmetic
◦ There are 10 distinct symbols, 0, 1, 2, …, 9
Computers use base 2 (binary) system
◦ There are only 0 and 1
These two binary digits are commonly referred to as
bits
Converting from Decimal to
Binary
Divide the decimal number by 2
repeatedly
Keep track of the remainders
Continue this process until the quotient
becomes zero
Write the remainders in reverse order to
obtain the binary number
Converting from Decimal to
Binary (cont.)
Converting from Binary to Decimal