The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

Measure resistance capacitance without Author: Sherman This


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet




Measure resistance capacitance without
Author: Sherman
This article describes measure values variable resistor variable capacitor using microcontroller measure charge time constant threshold voltage. variety these "one-shot" circuits described accuracy various methods measured. Sample programs 87C51 family presented article. "one-shot" monostable multivibrator circuit been around since discovery electron. Popular versions this variable pulse width generator include 74123 famous (Philips) Signetics NE555 timer. These circuits time charge capacitor predefined voltage their time delay. threshold voltage 1-1/e natural base), then time delay seconds exactly product resistance ohms capacitance Farads (t=RC). This linear equation used measure unknown value known. purpose this article describe ways measure RESISTANCE using this technique with 80C51 type microcontroller. Examining voltage across Capacitor versus time graph Figure obvious, hope, that time reach given voltage will directly proportional value fact equation delay time becomes: e-t/RC) From this equation, follows that: VC/VCC e-t/RC 1-VC/VCC e-t/RC
AN449
Since solving time, (1-VC/VCC) t/RC that VC/VCC)} where 1/{ln VC/VCC)}. Note that becomes constant VC/VCC held constant. This ratio voltages determined threshold comparator which connected monitor voltage, across capacitor. Thus, constant threshold voltage constant value capacitance, equation TIME reduces constant" which simple linear equation. from above equations that point valid threshold voltage long remains same each readings. threshold LM324 comparator, shown Figure VCC. 74HCTxx type digital logic used, threshold will approximately volts. 74HCxx logic used threshold will approximately volts. However, threshold different than 1-1/e, and/or, capcitance known exactly, will necessary calibrate system with known resistance.
Time Seconds
Figure
December 1993
Measure resistance capacitance without
AN449
this article have investigated different hardware techniques generating pulse with microcontroller, then resultant characteristics summarized. matrix variables consists following basic one-shot circuits shown Figures through various time measurement methods available common microcontrollers. more specific, time measured dividing microcontroller's oscillator frequency with internal timer gating counter one-shot. other method timing one-shot time enable then stop software DJNZ counter loop. order obtain some statistical comparison different circuits, wrote 80C51 assembly language program generate data histogram that standard deviation values could calculated. program first took readings counter/timer added results obtain byte wide answer. bytes were then used average readings. This equivalent dividing answer (shifting byte right bits). next sequence single reading taken average subtracted from displacement answer, which deviation from average, used increment location. locations were allocated locations around "average" value's location. This process repeated readings. Thus, readings same average five readings less than average nine readings greater than average, result shown Table Values beyond allocated deviation summarized counters ends allocated area. significant
number readings appear these overflow underflow counters, included shift routine reduce number bits reading until reasonable spread values could plotted. assembly language programs which used available from Philips BBS. first thing that noticed when started evaluate circuits strong shift center readings from average. using some freeze mist hair drier, found that cheap monolithic capacitor which using quite temperature sensitive. RULE NUMBER successful dependable readings capacitor which does vary with temperature. Polycarbonate, polypropylene, mylar good temperature coefficient dielectrics. These usually come some high voltage ratings also quite large size compared monolithic capacitor. versions monolithics available, sure check temp-co. Don't even think using electrolytic capacitor. first circuit which evaluated shown Figure attempt copy NE555 interior. half LM324 quad comparator used implement circuitry which external microcontroller. statistical program Assembly language program this article. were chosen same ratio NE555 timer. This value gives threshold voltage VCC, which very close 1/e) value one-shot delay time actual NE555 equation
Table
5.1K
GATED TIMER INPUT LM324
1N914 LM324 DRIVER
PROGRAM A2D02 Figure
December 1993
Measure resistance capacitance without
AN449
this circuit microcontroller "Driver" outputs logic non-inverting input comparator. open collector output comparator follows input shorts timing capacitor, ground. important allow enough time discharge capacitor ground, since residual charge capacitor will cause errors readings. "Gated Timer Input" will allow internal timer count signals divided down from microprocessor clock. divided down oscillator signals gated into counter while "Gated Timer Input" held high. measurement cycle starts when "Driver" transitions logic simultaneously releases short ground and, through diode, allows Gated Timer Input driven high other comparator which monitoring voltage across timing capacitor. When capacitor voltage exceeds reference voltage (RL/(RL+RU)) comparator, Gated Timer Input driven comparator timer halted. only resistor measured, possible eliminate diode using left over comparators LM324. inverting side should connected junction non-inverting input connected "Driver" output. Open Collector output comparator connected "Gated Timer Input". This will hold Gated Timer Input while capacitor being discharged will release Gated Timer Input line high same time that Capacitor released. Eleven resistor values were used obtain spread timer values which were then plotted determine linearity readings also check theory that this entire process really linear. Amazingly enough, plot really linear! spread samples resistor value greater larger values resistance. Using 0.47 polycarbonate timing capacitor with average value 0BEC0H deviation table shown Table From these deviation readings that sigma) readings within counts average. Shifting answer right places (dividing will result accuracy answer bit. This performance price half cent capacitor. rest circuits which have shown digital input place precision comparator first example. result,
accuracy resistance reading dropped range. Readings were taken with Gated Timer Input method with byte wide software DJNZ loop. accuracy between techniques virtually same, speed conversion four times faster with timer. timer counts 1/12 microprocessor oscillator frequency. Thus, full scale reading 0FFH would take (1/12MHz) microseconds. software timer loop consists loop formed clock cycles) DJNZ clock cycles) oscillator frequency divided time count. equation maximum integration time then: (1/12MHz) 1.02 milli-seconds software timer. first digital gate instead comparator circuits shown Figure Figure shows implementation single channel resistance measuring circuit Figure shows possible implement resistor measuring circuit. conversion subroutine Figure called A2D82. timing capacitor shorted ground open drain digital output 74HC05 inverter making microcontroller Driver output logic Upon release capacitor hold down signal, other digital gate acts high input impedance comparator with threshold approximately half CMOS about volts HCT. resistor version Figure alternately shorting timing capacitor side while starting timer measure opposite side. When wire NORed circuit sees logic from Vcap exceeding inverter threshold, active inverter pulls Gated Timer Input stop timer. There will slight offset error caused nonsimultanaity releasing capacitor start gated timer. This offset will constant dealt with calibration process subtracting constant from answer. Note that wired circuit depending quasi-bi-directional port pull resistor inside 80C51 type microcontroller. input microcontroller really open drain, will necessary pull-up resistor. This circuit idea extended channel circuit using last inverters 74HC05 package. three channel circuit uses four port pins. Likewise, used, channels implemented using seven port pins.
Table
December 1993
Measure resistance capacitance without
AN449
87C751
DRIVER
87C751
DRIVER 74HC05
GATED TIMER INPUT
DRIVER
74HC05
PROGRAM A2D82
GATED TIMER INPUT 74HC05
Single Resistor Conversion
74HC05
Dual Resistor Conversion
Figure
open drain outputs, open drain buffer eliminated shown Figure
OPEN DRAIN
Using this configuration, open drain output first discharge capacitor ground then gated timer enabled then open drain output programmed shown Program "A2DS02", which Philips BBS. slight offset error caused nonsimultanaity releasing capacitor start gated timer dealt with calibration process subtracting constant from answer. Figure example multiple channels also created using Figure configuration. Since there open drain outputs 87C51 Port possible make channel resistance reader which uses port bits additional input timer total port pins. Figure timer runs from release capacitor hold down detection level Software Timer Input port pin. heavy dark lines labeled "Time" indicate timing periods each four capacitor timing circuits. detection logic high capacitor which integrating current causes gate low. software timer halts when logic detected then driver transistor turned discharge capacitor. soon capacitor voltage goes below threshold logic one, gate returns high logic level shown "Input" section Figure
GATED TIMER INPUT
PROGRAM A2DS02 Figure
previous circuits will work with just about type microcontroller port I/O. Some microcontrollers programmed have open drain output configuration some port outputs only available open drain. Examples latter type port 87C51 family pins some 87C51 family derivatives (i.e. SDA, SCL, 87C751). With these
December 1993
Measure resistance capacitance without
AN449
87C51
PORT PORT PORT 74HC4002 DUAL 4-INPUT
PORT
GATED SOFTWARE TIMER INPUT
INPUT
TIME
Figure Figure have simplest embodiment timer. This configuration will allow Gated Timer, since Gated Timer input open drain. software counter technique used, where counter decremented input checked logic high (see Figure When counter stopped, value inverted give count-up appearing output. Ground bounce microcontroller caused clock distribution probably main source noise with this configuration. result answer, only repeatable within bits accuracy.
OPEN DRAIN
PROGRAM A2DS01 Figure
December 1993
Measure resistance capacitance without
AN449
ADLOOP: DJNZ
SDA,OVER
OVER:
;CHECK "SDA" JUMP LOOP WHEN RESULT,ADLOOP ;DECREMENT "RESULT" ;REPEAT. JUST DROP THROUGH ;RESULT SINCE FULL ;SCALE. RESULT,#0FFH COMPLEMENT ;COUNT-UP TYPE RESULTS. Figure
87C751
DRIVER 74HC00 GATED TIMER INPUT 74HC00
74HC00
PROGRAM A2DS06
Figure
December 1993
Measure resistance capacitance without
AN449
Figure operates when square wave output Driver then buffered 74HC00 give waveform shown falling edge will generate waveform shown output input NAND gate, will produce logic while input below threshold voltage approximately volts. rising edge will differentiated circuit produce waveform shown decay back ground will have same type exponential curve described original Figure decaying waveform, turned into digital pulse inverter's output signal, Again input NAND gate output, will high while input from low.
constant constant" equation will different waveform than waveform. However, readings from from will linearly correct, readings compared must separately calibrated. good news that 74HC00 most common probably cheapest digital available. circuit Figure uses strong pull-down drivers 80C51 produce waveform shown next Each successive drivers taken held there until 74HC30's output returns zero, indicating that input threshold been exceeded. this point, Gated Timer stopped counting results saved associated driver returned logic allow capacitor recover. test circuit this type configuration shown Figure Figure output Johnson counter first reset long pulse from driver, then sequence "short" pulses activates successive RCs. time that output Johnson counter high used precharge capacitor, "short" pulse must long enough allow voltage settle less than below VCC. When counter increments, previously high output falls zero produces waveform shown "CX" section. While voltage capacitor less than threshold 74HC30, will perceived digital logic low. NAND gate will produce pulse long inputs "low". Again, gated timer input will allow counter long 74HC30 output high, then save results proceed generating next "short" pulse from driver. Note that RRCR time constant should least three times long longest RXCX time insure that Reset threshold exceeded. circuit Figure uses 74HC138 line decoder produce negative going edges turn 74HC30 NAND gate. This circuit will conversions faster than Figure Johnson Counter, because capacitor precharging occurs while other being read. selected outputs decoder logic will precharge capacitors. When output selected three Address inputs, selected output will logic zero start timing sequence with gated timer input. Note that sufficient time must allowed capacitor precharge less than LSB, (VCC VCC/255), before output selected again.
80C51
DRIVER DRIVER DRIVER DRIVER 74HC30 NAND
DRIVER DRIVER DRIVER DRIVER GATED TIMER INPUT
Figure
circuit Figure another producing one-shot. timer from time that Driver logic time that Gated Timer Input goes low.
TEST RESULTS
OPEN DRAIN
GATED TIMER INPUT
PROGRAM A2DS04 Figure
accuracy readings seemed depend accuracy detection threshold voltage. circuit Figure which used comparator allowed readings sigma 14±1 bit. circuits which used digital logic gates detect threshold voltage, produced readings which were accurate 8±1/4 bit. these circuits results were same accuracy whether software internal hardware timer used. Finally, using microcontroller's Port digital threshold detection device, shown Figure could only produce answers. this still provide useful inputs truncated bits used Stick type input.
December 1993
Measure resistance capacitance without
AN449
74HC4017
80C51
DRIVER RESET 74HC30 NAND
COUNTER INPUT
DRIVER
RESET
"C0"
"C1"
"C2"
COUNTER INPUT "C0" "C1" "C2"
Figure
December 1993
Measure resistance capacitance without
AN449
74HC138 80C51
DRIVER DRIVER DRIVER
74HC30 NAND
COUNTER INPUT
COUNTER INPUT
Figure
December 1993
Measure resistance capacitance without
AN449
87C750
DRIVER
DRIVER PROGRAM A2D85
GATED TIMER INPUT
DRIVER
DRIVER
GATED TIMER INPUT
Figure
December 1993
Measure resistance capacitance without
AN449
80C51 ASSEMBLY LANGUAGE PROGRAMS
programs been listed below show section statistical data gathering. Note that actual code quite short. other programs which were used available Philips Bulletin Board System, BBS. phone number data sheets 80C51 family products available Philips IC20 "80C51-Based 8-Bit Microcontrollers" data book.
;*********** A2D02 ********** $MOD752 ;THIS PROGRAM TEST EXTERNAL COMPARATOR ;WITH INTERNAL TIMER CONVERSION. LDELAY 03FH ;COUNTER DELAY HDELAY 03EH ;COUNTER DELAY DISPL 03DH ;LOW DISPLACEMENT DISPH 03CH ;HIGH DISPLACEMENT AVCNT 03BH ;AVERAGE COUNTER SHFTCT 03AH SHIFT CTR. BOTTOM INTERMEDIATE LAVER ;MED INTERMEDIATE ;LOW AVERAGE HAVER INTERMEDIATE AVERAGE A2DL ;TEMP A2DH ;TEMP LDEL ;DELAY COUNTS HDEL ;HIGH DELAY SHIFTS ;NUMBER SHIFTS 0000H AJMP START 0100H START: R0,#3FH ;SET CLR. SETB P3.0 ;TURN ZERO: @R0,A ;RAM DJNZ R0,ZERO CLEARED IE,#0 ;DISABLE INTERRUPTS AVCNT,#0 ;CLEAR AVERAGE COUNTER ;THIS PART DOES DOUBLE PRECISION ADDS ;AND THEN ONLY BYTES USED AVERAGE. THIS ACTS LIKE DIVIDING GETAVR: ACALL ATOD CONVERSION A,A2DL ;LOW A,BOTTOM BOTTOM,A ;SAVE LOWEST BOTTOM A,A2DH ;HIGH ADDC A,LAVER LAVER,A ADDC A,HAVER HAVER,A ;HIGH AVERAGE DJNZ AVCNT,GETAVR ;LOOP December 1993
Measure resistance capacitance without
AN449
;NOW DEVIATION PART AVCNT,#0FFH ;CLEAR AVCNT DEVI: ACALL ATOD CONVERSION A,A2DL SUBB A,LAVER DISPL,A A,A2DH SUBB A,HAVER DISPH,A ;TH,TL AVERAGE DISP(H,L) ;DOUBLE PRECISION DIFFERENCE DISP(H,L) ;NOW DISP(H,L) NEG. ACALL ADDTEN ;ADD DISP A,DISPH ;CHECK ACC.7,CKOVER ;MSB POSITIVE DISPL,#0 ;NEG OVERFLOW,MAKE DISPH,#0 SJMP ;DISP RANGE ;NOW CHECK DISP(H,L) LARGER THAN A=DISPH FROM ABOVE CKOVER: MAKEHI ;UPPER BYTE A,DISPL A,#0E0H ;LOOK BITS ;JUMP DISP RANGE MAKEHI: DISPL,#1FH ;MAX ALLOWABLE DISP ACALL ADDTEN ;NOW R0,DISPL ;DISPLACEMENT DISPLACEMENT BETWEEN ;ADD SELECTED DJNZ AVCNT,DEVI AGAIN, P3.0 ;TURN TONE: HDELAY,#1H SOUND: DJNZ LDELAY,$ DJNZ HDELAY,SOUND P3.5 SJMP TONE ;DONE, MAKE TONE ;**********THIS SUBROUTINE ADDS DISP ADDTEN: A,#10H ;ADD MAKE A,DISPL DISPL,A ADDC A,DISPH DISPH,A
December 1993
Measure resistance capacitance without
AN449
;*********** THIS CONVERSION SUBROUTINE ATOD: SETB P1.5 ;P1.5 INPUT SETB P3.6 ;SHORT TH,#0 ;16BIT TIMER TL,#0 HDELAY,#HDEL ;SET DELAY TIME SETTL: LDELAY,#LDEL ;SET DELAY TIME DJNZ LDELAY,$ DELAY LOOP DJNZ HDELAY,SETTL ;UPPER DELAY LOOP TCON,#94H ;GATE, TR,IT0 ENABLE P3.6 ;START INTEGRATION WAIT: P1.5,GOOD ;WAIT P1.5 TF,WAIT ;CHECK OVERFLOW TCON,#0 ;OVERFLOW, STOP COUNTER TH,#0FFH ;MAKE FULL SCALE TL,#0FFH ;MAKE FULL SCALE GOOD: A2DL,TL ;SAVE A2DH,TH ;SAVE HIGH SETB P3.6 ;START DISCHARGING SHFTCT,#SHIFTS ;SHIFT RIGHT ;THIS PART WILL SHIFT RIGHT, SHFTCT TIMES. ;THIS DONE REDUCE PRECISION ANSWER ;BECAUSE SPREAD READINGS GREAT. SHIFT: A,SHFTCT ADDONE ;JUMP SHIFTS SHIFT A,A2DH A2DH,A A,A2DL A2DL,A DJNZ SHFTCT,SHIFT ADDONE:
December 1993

Other recent searches


XE8000 - XE8000   XE8000 Datasheet
UM1010 - UM1010   UM1010 Datasheet
LM317L - LM317L   LM317L Datasheet
KA317 - KA317   KA317 Datasheet
DS51079A - DS51079A   DS51079A Datasheet
CCD486 - CCD486   CCD486 Datasheet
AL9V576B-EVB-A2 - AL9V576B-EVB-A2   AL9V576B-EVB-A2 Datasheet
AL9V576B-EVB-A12 - AL9V576B-EVB-A12   AL9V576B-EVB-A12 Datasheet
0582460000 - 0582460000   0582460000 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive