microEngineering Labs, Inc.
    719-520-5323
 
Home:
  Developer Resources:

Programming Clues
    Sample Programs
   
    PICBASIC PRO™
Compiler Manual
    PICBASIC™ Compiler
Manual
    Serin2/Serout2 Modes
    ASCII Character Set
    Number Conversion
    Floating Point
Routines
    PBP Debug Monitor
    Articles and Tutorials

Hardware Clues
    Parts / Vendor List
    PICPROTO™ Boards
    LAB-X1 Docs
    LAB-X2 Docs
    LAB-X20 Docs
    LAB-X3 Docs
    LAB-X4 Docs
    LAB-XUSB Docs
    LAB-XT Docs
     
 

Decimal Number System

Overview - Number Systems

Probably the biggest stumbling block most beginning programmers encounter when attempting to learn assembly language is the common use of the binary and hexadecimal numbering systems. Understanding these numbering systems is important because their use simplifies other complex topics including boolean algebra and logic design, signed numeric representation, character codes, and packed data.

Microcontrollers don't use the decimal system to read and write numbers. Instead, they use a binary or two's complement numbering system. To understand the limitations of computer arithmetic, you must understand how computers represent numbers.

There are three number bases commonly used in PICBASIC. These are:

Name Base Symbol
Binary Base 2 %
Decimal Base 10 none
Hexadecimal Base 16 $

The Decimal Number Base Systems

The Decimal Number System uses base 10. It includes the digits from 0 through 9. The weighted values for each position is as follows:

Power of 10: 107 106 105 104 103 102 101 100
Value: 10000000 1000000 100000 10000 1000 100 10 1

You have been using the decimal (base 10) numbering system for so long that you often take it for granted. When you see a number like "123", you don't think about the value 123. Instead, you generate a mental image of how many items this value represents. In reality, however, the number 123 represents:

(1 * 102) + (2 * 101) + (3 * 100) =

(1 * 100) + (2 * 10) + (3 * 1) =

100 + 20 + 3 =

123