|
by George Martin
Start ı Stating
Our Case ı Working the Wiring ı A
Case Study in Timer Interrupts ı Sources
and PDF
Last month, I gave you a foundation in
signed and unsigned binary numbers and how the compilers, assembly
language, and CPUs support them. This month, Iıd like to talk about
how you can use these signed and unsigned numbers to your advantage.
WORTHY OF REPEATING
Remember, itıs good practice to use #typedefs
so youıre sure of the size of data being referenced. Letıs assume
you are writing code for a 16-bit CPU and your compiler defines a
char as 8 bits, int as 16 bits, and long
as 32 bits. Table 1 shows the typedefs that would be set up.
|
#typedef
#typedef
#typedef
#typedef
#typedef
#typedef
|
CHAR8
UCHAR8
INT16
UINT16
INT32
UINT32
|
char
unsigned char
int
unsigned int
long
unsigned long
|
| Table 1ıHere you
can see the typedefs that would be set up for a 16-bit
CPU with char as 8 bits, int as 16 bits, and long
as 32 bits. |
NEXT
Circuit Cellar provides up-to-date information for engineers. Visit
www.circuitcellar.com for
more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com
or subscribe online.
ıCircuit Cellar, the Magazine for Computer Applications. Posted with
permission. |