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

WORKING THE WIRING

Now, letýs assume the A/D converter is measuring acceleration. The readings have a range of 3 to ý3 g. Letýs also assume that the signal conditioning produces an electrical signal of ý5 V for ý3 g, 0 V for 0 g, and 5 V for 3 g. You could wire the 12-bit A/D a couple different ways. Hereýs one example:

CPU Bit
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
A/D Bit
x
x
x
x
11
10
9
8
7
6
5
4
3
2
1
0

 

The bits marked s are wired to Bit 11, the sign bit. Table 2 is the signed number system values.

Input
Signal
Hex
Decimal
3 g
5 V
0x07FF
2047
0 g
0 V
0x0000
0
ý3 g
ý5 V
0xF801
ý2047
ý3 g
ý5 V
0xF800
ý2048
Table 2ýHere you can see the signed number system values.

 

In the twoýs complement number system, there are 2048 positive numbers and 2048 negative numbers. Iýve wrestled with how to scale the bits. Is it 3 g per 2047 or 3 g per 2048? Iýll leave that up to you to decide.

WORKING THE WIRING WITH OVERFLOW

If you add readings together, you could stand 16 full-scale (either positive or negative) readings before you overflow the register in the CPU. So, averaging eight readings could be done without concern for overflow. If youýve got a system that needs some filtering, consider this input mapping:

CPU Bit
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
A/D Bit
11
10
9
8
7
6
5
4
3
2
1
0
x
x
x
x

 

The bits marked x are wired as zero. The signed number system values can be seen in Table 3.

Input
Signal
Hex
Decimal
3 g
5 V
0x7FF0
32752
0 g
0 V
0x0000
0
ý3 g
ý5 V
0x8010
ý32752
ý3 g
ý5 V
0x8000
ý32768
Table 3ýHere you can see more signed number system values for this example.

 

Each bit on the A/D converter has a binary weight of 16 in the CPU. In the twoýs complement number system there are 2048 positive numbers and 2048 negative numbers.

In this scaling, you cannot start adding numbers together. You probably would overflow (or underflow) immediately. But if the first step was a scaling that reduced the magnitude, youýre set up for it.

And, of course, you can wire the A/D inputs to any bit starting with 15 through 11. You would then have a scaling between the two examples Iýve described.

PREVIOUSNEXT


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