ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

MAKING THE NUMBERS WORK FOR YOU


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

MAKING THE NUMBERS WORK FOR YOU

Lessons from the Trenches 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.
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ