Numbering System Basics
Numbering System Basics
Given the ability to perform arithmetic processes (addition and multiplication) with the C28x, it is
important to understand the underlying mathematical issues which come into play. Therefore, we
shall examine the numerical concepts which apply to the C28x and, to a large degree, most
processors.
Binary Numbers
The binary numbering system is the simplest numbering scheme used in computers, and is the
basis for other schemes. Some details about this system are:
•
It uses only two values: 1 and 0
•
Each binary digit, commonly referred to as a bit, is one “place” in a binary number
and represents an increasing power of 2.
•
The least significant bit (LSB) is to the right and has the value of 1.
•
Values are represented by setting the appropriate 1's in the binary number.
•
The number of bits used determines how large a number may be represented.
Examples:
0110
2
= (0 * 8) + (1 * 4) + (1 * 2) + (0 * 1) = 6
10
11110
2
= (1 * 16) + (1 * 8) + (1 * 4) + (1 * 2) + (0 * 1) = 30
10
Two's Complement Numbers
Notice that binary numbers can only represent
positive
numbers. Often it is desirable to be able to
represent both positive and negative numbers. The two's complement numbering system modifies
the binary system to include negative numbers by making the most significant bit (MSB)
negative
. Thus, two's complement numbers:
•
Follow the binary progression of simple binary except that the MSB is negative — in
addition to its magnitude
•
Can have any number of bits — more bits allow larger numbers to be represented
Examples:
0110 = (0 * -8) + (1 * 4) + (1 * 2) + (0 * 1) = 6
2
10
11110
2
= (1 * -16) + (1 * 8) + (1 * 4) + (1 * 2) + (0 * 1) = -2
10
The same binary values are used in these examples for two's complement as were used above for
binary. Notice that the decimal value is the same when the MSB is 0, but the decimal value is
quite different when the MSB is 1.
Two operations are useful in working with two's complement numbers:
•
The ability to obtain an additive inverse of a value
•
The ability to load small numbers into larger registers (by sign extending)
C28x - Numerical Concepts & IQmath
8 - 3
Summary of Contents for C28 Series
Page 64: ...Summary 3 16 C28x Peripheral Registers Header Files ...
Page 78: ...Interrupt Sources 4 14 C28x Reset and Interrupts ...
Page 218: ...Lab 9 DSP BIOS 9 22 C28x Using DSP BIOS ...
Page 244: ...Lab 10 Programming the Flash 10 26 C28x System Design ...
Page 273: ...Appendix A eZdsp F2812 C28x Appendix A eZdsp F2812 A 1 ...
Page 276: ...Appendix P2 Expansion Interface A 4 C28x Appendix A eZdsp F2812 ...
Page 277: ...Appendix P4 P8 P7 I O Interface C28x Appendix A eZdsp F2812 A 5 ...
Page 278: ...Appendix A 6 C28x Appendix A eZdsp F2812 ...
Page 279: ...Appendix P5 P9 Analog Interface C28x Appendix A eZdsp F2812 A 7 ...
Page 282: ...Appendix A 10 C28x Appendix A eZdsp F2812 TP1 TP2 Test Points ...