MICROCHIP AN780

AN780
15-Kilogram Scale Using the TC500A and the TC520
Author:
The TC500A has no agenda of its own so it can be used to generate
slow, high resolution conversions or fast, low resolution conversions. The trade-off for accuracy is about 1000 counts per millisecond of integration time, i.e., 16-bits with TINT approximately equal
to 60mS. Typically, the total conversion time is about 4 times the
integration time but, with the TC500A, this is quite flexible.
Ted Dabney,
Microchip Technology, Inc.
INTRODUCTION
A 15kg weighing scale was designed using Microchip's TC500A
Analog Processor and the TC520 16-bit Controller. The scale is
required to resolve down to 1/8 gram and correct to within 61/2
gram. This project takes into account all aspects of a functional scale:
•
•
•
•
•
TINT = CINT RINT VINT/VIN (max)
eq1
The TC520 is a digital interface device which can be used to
replace all of the TC500A timing and counting functions performed
by a microprocessor. The TC520 can use either a crystal or
external clock as a time-base to control the operation of either a
TC500 or a TC500A.
Dynamic Range
Strain Gauge Compensation
Zeroing
Oversampling
Units Conversion (kilograms to pounds)
The TC500A is an analog processor device which performs a dualslope analog-to-digital conversion function. All of the counting and
timing for the conversion must be controlled by an external source.
In nearly all applications, this control source is a microprocessor.
The microprocessor is programmed to monitor the status and to
control the timing of the TC500A. It must also be programmed to
count the conversion results.
+
CREF
V+
REF
7 9
+
VREF
8 6
RI
SWZ
Analog
Common
–
VIN
5
10
C–
4
REF
BUF
SW+
RI
SWI
3
CAZ
1
TC500/TC500A
Integrator
–
+
SW+
RI
+
SWIZ
SW–
Comp 1
+
–
SW1
2
16
+
Level
Shift
14 Comp
Output
Polarity
Detection
Analog
Switch
Control
Signals
VS+
Comp 2
–
SWZ
RI
VS–
Control Logic
Converter State
Zero Integrator Output
Auto-zero
Signal Integrate
Deintegrate
CINT
Buffer
–
SW–
B
0
1
0
1
CAZ
SWR SWR
SWI
11
V+
IN
CINT
RINT
CREF
A
0
0
1
1
Phase
Decoding
Logic
12
15
GND
13
A
B
Control Logic
FIGURE 1: Functional block diagram.
© 2002 Microchip Technology, Inc.
DS00780A-page 1
AN780
+5V
*CINT
10k
CAZ
100k
RINT
VIN+
.01u
Crystal
3
CAZ
4 BUF
11
IN+
10
IN–
9
REF+
VIN–
.01µ
100k
COMP 14
B 13
A 12
CR– 6
8 REF–
5
COM
LM285-2.5
6
+V 16
1 INT
CREF
CR+ 7
GND 15
–V 2
OSCOUT
7
3
4
5
13
14
OSCIN
COMP
B
A
DV
CE
+V
LOAD
READ
DCLK
DIN
DOUT
1
12
8
10
11
9
LD
RD
SK
SO
SI
2 GND
TC520
TC500A
Analog Ground
CE
DGND
DV
*CINT recommended Polypropylene
–5V
FIGURE 2: TC500A and TC520
The 16-bit conversion result is accumulated in the TC520 along
with a polarity bit and an overrange bit. These bits are formed into
one 18-bit serial word which may be read at any rate and at any
time. Reading the serial data from the TC520 does not effect the
TC500A/TC520 conversion cycle except that the output shift
register will not update while reading is in progress.
DEVELOPING THE SCALE APPLICATION
USING THE TC500A AND THE TC520
Input Stage
The first consideration for a low signal level source is the amount
of gain required for the input amplifier. The TC500A has a CMOS
input buffer which, due to unity-gain phase margin, must have no
lower than about 68kΩ for RINT. The maximum buffer current
VIN(max)/RINT) should be no more than about 20µA. This means
that the maximum input voltage to the TC500A should be about
1.5V. The 15kG strain gauge used for this application has an output
of about 1mV/gram which gives a gain requirement of at least 50.
The MCP606 CMOS operational amplifier is best suited for this
because of its low noise and minimal drift. The output impedance
of the strain gauge is only 300Ω so a single-ended configuration
is more than adequate. Instead of 1.5V, the actual full-scale output
wound up to be about 1V. The value of RINT was set to 130kΩ, well
above the 68kΩ minimum. This gives a maximum buffer current of
7.6µA instead of 20µA.
DS00780A-page 2
Integrator Stage
The signal-to-noise ratio of the TC500A's integrator stage is a
function of the band-width. The 15kG scale needs to resolve 1g
with at least 8:1 over-sampling. This means at least 120,000
counts. The above rule of "1000 counts per millisecond" requires
at least 120ms for the integration time of the TC500A. Selecting
200mS will lower the band-width and get maximum rejection of 50/
60Hz. The strain gauge is a balanced bridge so the output will have
some common mode component. A value of 3.5V for VINT instead
of 4V will allow for some offset. Rearranging equation 1 gives an
expression for CINT:
CINT = VIN (max) TINT/VINT RINT
= 1V 200mS/3.5V 130k = .439mF
eq2
The next higher common value is .47µF which was selected for
CINT. It is essential that this capacitor is a polypropylene type for
very low dielectric absorption.
REFERENCE VOLTAGE CIRCUIT
The differential reference voltage is derived by the standard, dualslope ratiometric technique:
VREF = VIN (max) TINT/TDEINT
eq3
where TDEINT is the deintegration time required for a full-scale
conversion.
© 2002 Microchip Technology, Inc.
AN780
This application requires 120,000 counts which means that the
TC520's overrange bit must be used as the MSB, i.e., 17-bits. A
reference voltage with a tempco of 0.3ppm/°C would normally be
required for stability over a 30°C range. This could be a prohibitive
requirement. Fortunately the strain gauge has an output sensitivity
which is directly proportional to the supply voltage applied,
The TC500A has a differential reference input so the reference
voltage need not be referenced to ground. Rather than using a
precision reference for the TC500A and a precision supply for the
strain gauge, combining eq3/a and eq3/b into eq4 produces an
equation for the system:
TDEINT = K G PSG TINT RTOTAL/RREF
VSG = K (V+ – V–)PSG,
eq4
eq3/a
where K is the constant for a particular strain gauge and the dual
slope converter produces a result which is inversely proportional to
its reference voltage:
Notice that VIN has been replaced by an expression for the
pressure on the strain gauge (PSG), the strain gage constant (K)
and the gain of the amplifier (G). The actual differential reference
voltage is determined only by the ratio of resistance values (RTOTAL/
RREF ).
TDEINT = VIN TINT/VREF
By deriving the reference from the supply voltage, any variations
will exactly cancel.
VREF = RREF x (V+ – V–)/RTOTAL
eq3/b
+5V
CINT
RINT
V+
4
BUF
R1
11
RB
PSG
Strain Gauge
2
–
RA
+
VSG
7
–
10
6
3 +
4
VIN
R2a
R2b
3
CAZ
CAZ
1
CINT
VIN+
VIN–
TC500A
9
+
VREF+
8 V
REF–
R3
VREF
Analog
CREF+ CREF– V– Common
6
7
2
5
R4
.68µ
V–
–VSG = K PSG (V+– V–)
G = –RB/RA
RREF = R2B + R3
RTOTAL = R1 + R2 + R3 + R4
VIN = (V+– V–) PSG K G
VREF = (V+– V–) RREF/RTOTAL
TDEINT =
VIN
VREF
TINT =
(V+– V–) PSG K G
(V+– V–) RREF/RTOTAL
TINT = PSG K G
RTOTAL
RREF
Ground
–5V
TINT
FIGURE 3: Differential ratiometric reference voltage.
© 2002 Microchip Technology, Inc.
DS00780A-page 3
AN780
AUTO-ZERO AND REFERENCE CAPACITORS
The voltage on these capacitors stay very constant so dielectric
absorption is not a consideration. The long integration time does
require capacitors with very low leakage. A .68µF polyester
capacitor was used in both cases.
TC520 TIMING
A 200ms integration time is already selected. There are a few
options available with the TC520 to do this. The exact crystal (or
clock rate) can be select in conjunction with one of the two default
timings in the TC520 or, the microprocessor can be used to
program the TC520 for the proper timing with some arbitrary crystal
frequency. The main constraint is that the TC500A has a comparator
delay of about 4µS. Also, the TC520 has a divide-by-4 on the clock
input. This means that anything around 1MHz will be acceptable.
The TC520 can be programmed by the micro to set the actual
integration time to within approximately .5ms. The crystal used in
this application is 1.0703MHz.
DS00780A-page 4
There are 4 clocks/count in the TC520 and the base integration
counter is 256 counts. This calculates to a timebase period of
0.9567mS with the crystal being used. The 200mS integration time
requires 209 timebase periods. Since the TC520 gives 256 timebase
periods, 47 of them need to be taken away. The value can be
determined from the equation:
N = 256 –
fOSC x TINT
= 256 – 1.0703MHz x 200mS = 46.957
1024
1024
The micro was programmed to load a "47" (2FH) into the TC520 at
the start of the program. This will cause the TC500A to have an
integration time of 199.96mS. This value will give at least 120dB of
rejection at 50/60Hz.
The TC520 will also use the integration timing for the TC500A's
Auto-Zero phase. A 17-bit conversion will require a deintegration
time which is a function of the oscillator frequency, i.e.,
217 x 4 ÷ fOSC = 490mS.
© 2002 Microchip Technology, Inc.
© 2002 Microchip Technology, Inc.
15K
Strain
Gauge
+
–
20K
7
–
3 +
4
2
0.1µ
1.0M
MCP606
6
47µ
≈0V
15K
10K
≈.3V
≈.5V
10
24K
VREF+
VIN–
VIN+
V+ 16
DGND 15
A 12
B 13
COMP 14
.68µ
Reset
V+ GND
TC520
2 DGND
5 A
4 B
3 COMP
1 V+
DCLK
READ
8
DOUT 9
10
DIN 11
RC4/SI
RC3/SK
RC5/SO
RC1
RC0
GND
8, 19
18 RC1
RB3
8MHz
8MHz OSC.
(HC04)
RB0
CKI
9
21
RB1 22
RB2 23
24
1, 19
3
5
7
9
12
RB5 26
25
16
14
RB6 27
RB4
18
VCC
28
RB7
20
20
17
15
13
11
8
6
4
2
DS1 DS2 CS1 CS2 B0 B1 B2 B3 OSC
47K
1
Reset
17 RC6
15
14
16
12
LOAD
11
12
DV 13
7
6
OSCIN OSCOUT
1.07MHz
±5V
Power Supply
Analog
CREF+ CREF– V– Common
7
2
6
5
8 V
REF–
0.1µ 9
0.1µ
11
.68µ
3
1
CAZ
CINT
.47µ
TC500A
–5V
33K
33K
22K
4
BUF
130k
B0 B1 B2 B3 OSC
TC7211AM
PIC16C62A
GND
+
IN–
IN+
+5V
V+ GND DS1 DS2 CS1 CS2
TC7211AM
47K x 8
AN780
74HTTC244
FIGURE 4: Kilogram scale schematic.
DS00780A-page 5
AN780
READ
Read Format
DOUT
OUT
LSB
OVR POL MSB
DCLK
LOAD
Load Format
DIN
MSB
LSB
DCLK
FIGURE 5: Serial interface protocol.
REFERENCE VOLTAGE CALCULATION
CONCLUSION
Now that the timing has been determined, eq3 can be used to
calculate the reference voltage:
The scale works extremely well. The 8X oversampling makes it
very smooth and noise-free. The response time is within one
conversion (≈1/2 sec) for changes of 2 grams or more. Changes of
less than 2 grams are accumulated in an integrating register until
it gets to either +1 gram or –1 gram. When this happens, the current
conversion is allowed to "get through" and a new base is established in the accumulator.
VREF = VIN (max) TINT/TDCINT
= 1V 200mS/490mS ≈ .408V
The reference voltage does not need to be calculated very precise
since it will have to be trimmed during calibration. A ±25% adjustment range is enough to make up for just about any minor
calculation error.
MICROPROCESSOR PROGRAMMING
The PIC16C62A 8-Bit microcontroller was selected but any
reasonable processor/controller will suffice. The PIC16C62A is a
28-pin part that has EPROM programmability.
There is also a facility in the programming that allows the raw data
to be displayed. These displays show the full 17-bit conversion
results. The basic converter noise is as predicted, typically 1 to 2
counts of flicker (16-bit accuracy) with an intermittent jump of
about 3 or 4 counts (1/f noise). One count is equivalent to 1/8 gram.
The actually 60Hz power line rejection ration of the TC500A was
not measured, but judging from the 6 to 8 counts of "rolling noise"
before preloading the TC520 with 2FH, it is quite adequate.
The effect of the differential ratiometric reference was tested by
changing the supply voltage from +4V to +6V. Although there was
a 1 – 2 second delay due to unmatched time constants between
the reference and the strain gauge, the final readings were exactly
the same. This shows that the power supply rejection is better
than 100dB.
DS00780A-page 6
© 2002 Microchip Technology, Inc.
AN780
Start
Power
Setup
Output
A=0
B=0
Comparator
?
Zero Integrate
No
Low
Yes
Read Conversion Results from TC520
High
Output
A=0
B=1
Auto Zero
Save Results as Offset Value
Start
Timer
Timer
Overflow
?
Yes
Clear
Count
Overrrange
Output
A=1
B=0
Latch Count
Overrange
Polarity
No
No
Conversion
Complete
?
Yes
Integrate
Read Conversion Results from TC520
Subtract Offset Value
Stop
Counter
Timer
Overflow
?
Yes
No
Comparator
?
Low
Set Polarity Bit
No
15 Times
?
Yes
Start
Timer
High
Conversion
Complete
?
Delta = This Reading - Saved Reading
No
Add Delta
to Register
Reset Polarity Bit
Register
Overflow
?
Yes
Delta >
2 Grams
?
Yes
Restore Register
Save This Reading
Output
A=1
B=1
Deintegrate
Retrieve Saved Reading
Divide by 8
Start
Counter
Low
Counter
Overflow
?
FIGURE 6: TC520 program flow chart.
© 2002 Microchip Technology, Inc.
Multiply by 22046
Comparator
?
High
No
Yes
Pounds
?
No
Convert Binary to BCD
Set Overrange Bit
Yes
Display
FIGURE 7: PIC16C62A program flow chart.
DS00780A-page 7
AN780
NOTES:
DS00780A-page 8
 2002 Microchip Technology Inc.
Information contained in this publication regarding device
applications and the like is intended through suggestion only
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
No representation or warranty is given and no liability is
assumed by Microchip Technology Incorporated with respect
to the accuracy or use of such information, or infringement of
patents or other intellectual property rights arising from such
use or otherwise. Use of Microchip’s products as critical components in life support systems is not authorized except with
express written approval by Microchip. No licenses are conveyed, implicitly or otherwise, under any intellectual property
rights.
Trademarks
The Microchip name and logo, the Microchip logo, FilterLab,
KEELOQ, microID, MPLAB, PIC, PICmicro, PICMASTER, PICSTART, PRO MATE, SEEVAL and The Embedded Control Solutions Company are registered trademarks of Microchip
Technology Incorporated in the U.S.A. and other countries.
dsPIC, ECONOMONITOR, FanSense, FlexROM, fuzzyLAB,
In-Circuit Serial Programming, ICSP, ICEPIC, microPort,
Migratable Memory, MPASM, MPLIB, MPLINK, MPSIM,
MXDEV, PICC, PICDEM, PICDEM.net, rfPIC, Select Mode
and Total Endurance are trademarks of Microchip Technology
Incorporated in the U.S.A.
Serialized Quick Turn Programming (SQTP) is a service mark
of Microchip Technology Incorporated in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2002, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
Microchip received QS-9000 quality system
certification for its worldwide headquarters,
design and wafer fabrication facilities in
Chandler and Tempe, Arizona in July 1999. The
Company’s quality system processes and
procedures are QS-9000 compliant for its
PICmicro® 8-bit MCUs, KEELOQ® code hopping
devices, Serial EEPROMs and microperipheral
products. In addition, Microchip’s quality
system for the design and manufacture of
development systems is ISO 9001 certified.
 2002 Microchip Technology Inc.
DS00780A - page 9
M
WORLDWIDE SALES AND SERVICE
AMERICAS
ASIA/PACIFIC
Corporate Office
Australia
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200 Fax: 480-792-7277
Technical Support: 480-792-7627
Web Address: http://www.microchip.com
Microchip Technology Australia Pty Ltd
Suite 22, 41 Rawson Street
Epping 2121, NSW
Australia
Tel: 61-2-9868-6733 Fax: 61-2-9868-6755
Rocky Mountain
China - Beijing
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7966 Fax: 480-792-7456
Microchip Technology Consulting (Shanghai)
Co., Ltd., Beijing Liaison Office
Unit 915
Bei Hai Wan Tai Bldg.
No. 6 Chaoyangmen Beidajie
Beijing, 100027, No. China
Tel: 86-10-85282100 Fax: 86-10-85282104
Atlanta
500 Sugar Mill Road, Suite 200B
Atlanta, GA 30350
Tel: 770-640-0034 Fax: 770-640-0307
Boston
2 Lan Drive, Suite 120
Westford, MA 01886
Tel: 978-692-3848 Fax: 978-692-3821
Chicago
333 Pierce Road, Suite 180
Itasca, IL 60143
Tel: 630-285-0071 Fax: 630-285-0075
Dallas
4570 Westgrove Drive, Suite 160
Addison, TX 75001
Tel: 972-818-7423 Fax: 972-818-2924
Detroit
Tri-Atria Office Building
32255 Northwestern Highway, Suite 190
Farmington Hills, MI 48334
Tel: 248-538-2250 Fax: 248-538-2260
Kokomo
2767 S. Albright Road
Kokomo, Indiana 46902
Tel: 765-864-8360 Fax: 765-864-8387
Los Angeles
18201 Von Karman, Suite 1090
Irvine, CA 92612
Tel: 949-263-1888 Fax: 949-263-1338
China - Chengdu
Microchip Technology Consulting (Shanghai)
Co., Ltd., Chengdu Liaison Office
Rm. 2401, 24th Floor,
Ming Xing Financial Tower
No. 88 TIDU Street
Chengdu 610016, China
Tel: 86-28-6766200 Fax: 86-28-6766599
China - Fuzhou
Microchip Technology Consulting (Shanghai)
Co., Ltd., Fuzhou Liaison Office
Unit 28F, World Trade Plaza
No. 71 Wusi Road
Fuzhou 350001, China
Tel: 86-591-7503506 Fax: 86-591-7503521
China - Shanghai
Microchip Technology Consulting (Shanghai)
Co., Ltd.
Room 701, Bldg. B
Far East International Plaza
No. 317 Xian Xia Road
Shanghai, 200051
Tel: 86-21-6275-5700 Fax: 86-21-6275-5060
China - Shenzhen
150 Motor Parkway, Suite 202
Hauppauge, NY 11788
Tel: 631-273-5305 Fax: 631-273-5335
Microchip Technology Consulting (Shanghai)
Co., Ltd., Shenzhen Liaison Office
Rm. 1315, 13/F, Shenzhen Kerry Centre,
Renminnan Lu
Shenzhen 518001, China
Tel: 86-755-2350361 Fax: 86-755-2366086
San Jose
Hong Kong
Microchip Technology Inc.
2107 North First Street, Suite 590
San Jose, CA 95131
Tel: 408-436-7950 Fax: 408-436-7955
Microchip Technology Hongkong Ltd.
Unit 901-6, Tower 2, Metroplaza
223 Hing Fong Road
Kwai Fong, N.T., Hong Kong
Tel: 852-2401-1200 Fax: 852-2401-3431
New York
Toronto
6285 Northam Drive, Suite 108
Mississauga, Ontario L4V 1X5, Canada
Tel: 905-673-0699 Fax: 905-673-6509
India
Microchip Technology Inc.
India Liaison Office
Divyasree Chambers
1 Floor, Wing A (A3/A4)
No. 11, O’Shaugnessey Road
Bangalore, 560 025, India
Tel: 91-80-2290061 Fax: 91-80-2290062
Japan
Microchip Technology Japan K.K.
Benex S-1 6F
3-18-20, Shinyokohama
Kohoku-Ku, Yokohama-shi
Kanagawa, 222-0033, Japan
Tel: 81-45-471- 6166 Fax: 81-45-471-6122
Korea
Microchip Technology Korea
168-1, Youngbo Bldg. 3 Floor
Samsung-Dong, Kangnam-Ku
Seoul, Korea 135-882
Tel: 82-2-554-7200 Fax: 82-2-558-5934
Singapore
Microchip Technology Singapore Pte Ltd.
200 Middle Road
#07-02 Prime Centre
Singapore, 188980
Tel: 65-6334-8870 Fax: 65-6334-8850
Taiwan
Microchip Technology Taiwan
11F-3, No. 207
Tung Hua North Road
Taipei, 105, Taiwan
Tel: 886-2-2717-7175 Fax: 886-2-2545-0139
EUROPE
Denmark
Microchip Technology Nordic ApS
Regus Business Centre
Lautrup hoj 1-3
Ballerup DK-2750 Denmark
Tel: 45 4420 9895 Fax: 45 4420 9910
France
Microchip Technology SARL
Parc d’Activite du Moulin de Massy
43 Rue du Saule Trapu
Batiment A - ler Etage
91300 Massy, France
Tel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79
Germany
Microchip Technology GmbH
Gustav-Heinemann Ring 125
D-81739 Munich, Germany
Tel: 49-89-627-144 0 Fax: 49-89-627-144-44
Italy
Microchip Technology SRL
Centro Direzionale Colleoni
Palazzo Taurus 1 V. Le Colleoni 1
20041 Agrate Brianza
Milan, Italy
Tel: 39-039-65791-1 Fax: 39-039-6899883
United Kingdom
Arizona Microchip Technology Ltd.
505 Eskdale Road
Winnersh Triangle
Wokingham
Berkshire, England RG41 5TU
Tel: 44 118 921 5869 Fax: 44-118 921-5820
03/01/02
DS00780A
DS00780A-page 10
 2002 Microchip Technology Inc.