41
Example 2
Note that this application can also be satisfied in some cases with 0.000125 inch resolution and a
standard 27-28 MHz clock crystal.
A.3 BCD Output Selection
Notes on BCD Output
When specified, digital systems can provide BCD (Binary Coded Decimal) output. BCD code is a
binary method of representing decimal numbers. In BCD notation, each decimal digit is converted
into a four-bit binary number. The BCD code for a decimal number is a string of four-bit binary
numbers, each representing one decimal digit. Only the following binary groups are used:
Decimal Binary Decimal Binary
0 000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
For example, the decimal number 8.74 is encoded in BCD as a 12-bit binary number:
Decimal 8 . 7 4 = 8.74
BCD 1000 . 0111 0110 = 1000.01110100
In many cases, the BCD code for a stroke length lies within a range of BCD numbers where
some bits never change value. For example, 19.999 inches can be represented in BCD by the 20-
bit number
00011001.100110011001
Notice that, for all values from 0 up to 19.999, the first three bits will always be zero. This means
that the remaining 17 bits are sufficient to encode a stroke of 19.999 inches; that is, one counter
card is sufficient. Table 3A lists the maximum stroke length versus number of significant bits (for
a resolution of 0.001 inch). By moving the decimal point, the number of bits required for all other
resolutions can be determined.
Given
• Stroke: 48 in.
• Resolution: 0.0001 in.
• Maximum Update Time: 30 milliseconds
Specify
Number of bits required: 18
Resolution (R): 0.0001 in.
(Re)circulations: 32
Update Time: less than 25 ms.
fc: 34 MHz
1. 48 ÷ 0.0001 = 480,000 counts. From Table A-1,
this requires 19 bits.
2. f
c
= 0.11/0.0001 = 1100 MHz
3. Try N = 2, and divide f
c
by N: 1100/2 = 550. This
is greater than 56 MHz
4. Try N = 4, and divide: 1100/4 = 275. This is also
greater than 56 MHz.
5. Try N = 8, 16, and 32. For N = 32, the clock crystal
value is 34.4 MHz.
6. The graph in Figure A-1 indicates an update time
of less than 25 milliseconds (which is acceptable).
7. Repeat Steps 1-6, using half the resolution, and
note that the update time is unacceptable.