Shop OBEX P1 Docs P2 Docs Learn Events
Comparator module detailed specs? — Parallax Forums

Comparator module detailed specs?

Tracy AllenTracy Allen Posts: 6,666
edited 2005-01-13 21:44 in General Discussion
I have an application (kind of like a switched capacitor dual slope converter) where the comparator module on the SX20 might help. I've never used the module and the specs in the data sheet are thin and not encouraging. In particular, the SX20 data sheet specs a 0.4 to Vdd-1.3 input common mode range, while the SX48 data sheet specs rail to rail input common mode range. Is the SX20 really stuck with the poor specs? This project needs to operate on 3 volts, so the input CM range is important. Also, the propagation delay of 250 ns seems slow. That is time to execute 5 instructions on the processor with a 20mhz clock. Is 250ns the time both for the state to appear in the comparator register and also the time for it to propagate to the B0 output?

I wonder if anyone has any advice on it or could point me to more information. Thanks! (and happy new year.)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
«1

Comments

  • BeanBean Posts: 8,129
    edited 2004-12-30 22:45
    Tracy,
    I haven't used the comparitor in any project, but like you I fine the spec very thin. I wonder if you can use it in analog mode with a feedback resistor from the output to the negative input ???

    Jon has used the comparitor in his "Serial Line Follower" his code may help. Otherwise I guess you have to use the old "try it and see" method.
    Jon's project is under "nuts & volts vol. 5" project # 116 "Basic stamp accessories made easy"

    Bean.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2004-12-31 23:58
    Okay, it will be a try-it-and-see approach some time in the next few weeks.

    -- reference voltage from a pot to rb1
    -- switched voltage driven from rb3, a second pot to rb2.
    -- trigger the 'scope on rb3, to start a test of propagation time.
    ---- look at rb0 on 'scope channel 2.
    ---- With the mode register pointing to CMP_B, also find how many clock cycles it takes before the transition appears in the CMP_RES bit, by inserting different numbers of NOPs before the mov !rb,w.
    -- repeat tests for a range of input levels to check the CM input spec.

    The diagram in the spec sheet does look like it could be used in analog mode, once enabled. I don't know about negative feedback (op amp) mode. Comparators usually don't make great op amps. I was thinking more in terms of positive analog feedback, to create an upper and lower threshold window.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • KenMKenM Posts: 657
    edited 2005-01-01 02:42
    What do you want the upper and lower threshold voltages to be? With a small amount of external hardware I think it can be accomplished.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-01-02 17:40
    Well to paraphrase Geunther's book rb.0 = 1 when (rb.2 - Vss) > (rb.1 - Vss) and is 0 otherwise, so as you have already noted rb.1 is the reference voltage, one possible means of doing range detection is using another pin (say rb.3) to the control gate of a 2:1 analog mux with the output connected to rb.1 and your upper and lower voltage thresholds fed into the 2 inputs. Another possibility is using port A as a software controlled DAC then feed that into rb.1 but obviously will consume more I/O pins.

    Paul

    Pardon me I didnt fully read your first post, So I didnt really end up answering it. Without investigating completely you are probably correct that the CM voltage is pretty poor especially·@ 3V. You need a rail to rail comparator, since that requires quite a few more transistors to implement it is quite unlikely that the SX is a rail to rail comparator. I believe the comparator feature of the SX is just a convenience feature to implement rudimentary ADC's and what not. Though adding an external rail to rail op amp configured as a comparator (ie no feedback) should not add much cost or space (soic-8's are pretty small, for that matter so is a dip-8 if your not comfortable with surface mount).

    Post Edited (Paul Baker) : 1/2/2005 5:47:44 PM GMT
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-02 20:31
    My initial idea was to set the thresholds at 1 volt and 2 volts with Vdd=3 volts. That takes only three resistors with feedback from rb0 to the rb3 input. However, it appears that the upper CM limit on the SX20 would be around 1.7 volts. An external comparator like the MAX987 would give rail to rail inputs, 120ns propagation time, in an SOT23 package, and 80 microamps supply. However, I'd like to use the built-in comparator in order to minimize size and cost. I'll guess I'll revise it to use a single threshold, and a charge balancing technique instead of dual slope integration.

    The app is to measure variable unknown capacitances in a physical process using charge transfer switches. The charge transfer pulses have to be on the order of 50ns to minimize and then to measure charge storage effects.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-01-03 00:14
    Ok now that I know what you are trying to do (I had to do a little brush up), why not use the schmitt trigger feature of the b or c port for your needs? If your running the SX at 3 V, if they have V+ and V- similar to the 74HC14 the corresponding thresholds should be around 1V and 2V (Phillips 74AHC14 has V+=2.2 and V-=0.9). You can verify the SX's V+ and V- easily. If you need to expand the hystersis (you probably won't) http://www.edn.com/contents/images/91301di.pdf·page 76 figure 3 is a pretty good circuit to implement. Best of all theres no pesky propagation delay. smile.gif· If you used a digipot you can control the R (and the associated dis/charge time so that the·measurement does not take either too long nor too short)·to accomodate·a wide range of capacitance you can measure to a reasonable amount of accuracy.

    Paul

    Post Edited (Paul Baker) : 1/3/2005 12:38:20 AM GMT
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-03 05:46
    Thanks for pointing that out. The Schmitt trigger might just be the ticket for this. I hadn't noticed that it was available on all the port B pins.

    The data sheet I have is even more sketchy on the electrical characteristics of the Schmitt trigger than it is on the comparator. No mention of what the thresholds are supposed to be. Like you say, I can measure it on one or a few and assume that is typical. PIC12F6xx Schmitt inputs have thresholds spec'd at V0=Vdd*0.2 maximum and V1=Vdd*0.8 minimum.

    The precise threshold value will not matter too much in my application. I already have this working using a single-slope technique, but need to wring a little more accuracy and repeatability out of it. The dual slope or charge balancing measurement puts the burden on a stable reference capacitor and takes the precise thresholds and the integration capacitor out of the equation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-06 17:32
    Here are results of tests on one SX28. Maybe these observations can be of use to others.

    Schmitt trigger inputs, testing for lower and upper threshold, V0 and V1.
    Test done with 10kohm potentiometer from Vdd to Vss, with 10uf capacitor on the wiper.
    * Vdd = 5 volts
    - test on rb1: V0=0.95 volts, V1=3.43 volts (note not symmetrical wrt Vdd/2)
    - test on rb2: V0=1.15 volts, V1= 3.51 volts (i.e., small variations pin to pin)

    * Vdd = 4.2 volts
    - test on rb2: V0=0.75 volts, V1=3.05 volts

    * Vdd = 3.0 volts
    - test on rb2: V0=0.6 volts, V1=2.1 volts

    The Schmitt thresholds do not depend on the setting in the LVL register (CMOS vs TTL)--The Schmitt trigger is a separate signal path.

    Comparator threshold common mode input range, SX28.
    CMP_B register set to zero to enable comparator action with feedtrough to rb0 output.
    Test done with 10k pots from Vdd to Vss as above, one for rb1 and one for rb2.

    * Vdd = 5 volts
    - Comparator worked from less than 0.05 up to 4.9 volts. However, the offset degrades at the extremes, at the high end especially. For example, with rb2 = 1.5 volts, switching occurred at rb1 = 1.51 volts, a 10 millivolt offset. At rb2 = 4.8 volts, switching occurred at rb1 = 4.57 volts, a 230 millivolt offset. Above 4.9 volts there was no comparator action.

    * Vdd = 3 volts
    - Comparator functioned from less than 0.05 volt up to a little less than 2.8 volts. The offset degraded above 2 volts.

    Comparator response time:
    Test done by connecting rb0 (comparator output) to rb1 (comparator inverting input) and a voltage source (potentiometer) to rb2 (comparator non-inverting input). This turns the comparator into an oscillator with a period determined by the propagation delay. Observe the effect of varying the voltage Vref on the (+) input. That changes the oscillator period (indirectly measuring the propagation delay).

    * Vdd = 5 volts
    - minimum period, 42 nanoseconds, when Vref=1.3 volts
    - period stays in the range of 42 to 60 nanoseconds for Vref in the range of 0.1 volt to 3.8 volt
    - period lengthens and degrades rapidly above 3.8 volts and below 0.1 volts

    * Vdd = 3 volts
    - minimum period, ~60 nanoseconds, from Vref=0.9 to 1.5 volts
    - period at Vref=0.1 volt is 75 nanoseconds, 195 nanoseconds at Vref=0.03 volts.
    - period at Vref=1.9 volts is 90 nanoseconds, degrades rapidly above 2 volts.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • KenMKenM Posts: 657
    edited 2005-01-07 15:30
    Tracy,

    Please excuse me if I missed the information in your post.

    When you measured the comparitor response time, what speed was the SX clocked at?

    I am guessing 50 MHz based on the results.

    Ken
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-08 03:44
    It is an analog comparator and operates independent of the processor clock. I had been running it on internal OSC4MHZ, but after you asked, I checked it at both OSC32KHZ and at 50 mhz with external clocking. No change in the oscillator period. That agrees with data sheet and the sx-key guide, "The comparator is independent of the clock source and thus will operate even if the SX chip is halted or in SLEEP mode.". I think the comparator can wake the processor if rb.0 is configured as a wakeup source and as the comparator output.

    More. Bit 0 in the CMP_B register follows the result of the compare (and is synced with the processor clock). I wanted to check its speed. I hooked rb.7 up to rb.1 and left rb.2 hooked up to a variable voltage (potentiometer, Vss to Vdd). The program sets rb.7, reads the CMP_B register, and transfers rb to rc. Like this:

    mode #$08
      mainloop
      setb rb.7     ; comparator input high
      mov !rb,#$00  ; exchange cmp_b with w
      mov rc,w     ; this sets rc.0 equal to bit0 of CMP_B
       clrb rb.7   ; comparator input low
       mov !rb,#$00    ; get CMP_B
       mov rc,w       ; sets rc.0 equal to bit0 of CMB_B
      jmp mainloop
    




    My thought was that at high clock speeds, reading CMP_B immediately after toggling the comparator input might not leave enough time for the bit to propagate through into the bit0 of CMP_B. For this test, the 'scope was triggered by rb.7, the comparator input, and a second probe tested rc.0, which should follow the value of the CMP_B result bit. Looking at the data sheet, where it claims a 250 nanosecond propagation time, I was thinking I might have to insert a NOP or two or more in between setting the comparator input and reading the result. But no, it turns out that even with a 50 megahertz clock, the result appears on rc.0 three clock cycles after the input toggles. And that was true for input levels from 0.04 volts up to 4.2 volts.

    I haven't tested it yet with smaller input overdrives, or with a 3 volt Vdd, but I was pleasantly suprised by the input range and by the speed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • BeanBean Posts: 8,129
    edited 2005-01-08 04:03
    I'm thinking that the comparitor is one of the "often overlooked" features of the SX.
    But that may be because of it's lack of documentation.

    Bean.
  • KenMKenM Posts: 657
    edited 2005-01-08 04:26
    For what it is worth, I am using the comparitor now in an application. Nothing fancy like Tracy is doing, just a simply comparitor.

    I it performing well.

    Ken
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-08 17:56
    I'd prefer to use the comparator for this application, as consistency & ow noise is more important than the exact threshold. With the comparator I think it is possible to lay out the circuit with a good quiet ground point as a reference for both the (+) and (-) inputs. On the other hand, with the Schmitt trigger or regular thresholds, the ground reference is inside the chip there is a residue of uncontrolled ground bounce even if the external circuit reference point is right at the chip Vss pin. Ground bounce becomes very evident when you look at these traces on the 'scope.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-08 20:33
    Hello "Comparator Guys",

    I just got a project where using the SX comparator makes a lot sense. I'll have to monitor a fan, and issue an alarm if it is stuck, off, or when the air outlet is blocked.

    Under normal operating conditions, the fan consumes about 20 Watts. When it is blocked, I'm pretty sure that the power consumption will go up. When it is off, power consumption will be zero, and when the air outlet is blocked, power consumption will be below regular. The last statement may surprise on the first glance - but did you ever notice the sound of a vacuum cleaner when you close the nozzle - it goes up, i.e. the motor turns at higher RPMs because there is no air to be moved, i.e. less workload.

    I'll put a small transformer's secondary side in series with the fan, and connect a rectifier to the primary side. The resulting, filtered voltage after the rectifier should be proportional to the fan's power consumption. This DC signal (adjustable by a trim-pot) will be fed into one of the SX comparator inputs. The other (reference) input will be alternatively connected to two different adjustable reference voltages in order to compare the current fan's power consumption against the allowed max/min values.

    I have "breadboarded" the hardware, and wrote the SX software, so I'm pretty close to test the system.

    I'll keep you informed about my experiences with the comparator later.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-08 23:49
    G
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-09 00:15
    Chris,

    I remember my mother saying "now it is working very hard" when her vacuum cleaner's airway was blocked, and I believed this for a long time smile.gif . Later, I've learned that motors usually make more RPMs when running w/o load.

    In the meantime, I have tested the system, and it seems to work as expected. I'll keep you posted when it is finished.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-09 00:20
    Thank you...I am finding it a little difficult to get a really good feel for the SX after years of dealing with other CPUs...I am reading your book, however...



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-09 00:47
    Chris,

    I'm still up, although it is more than an hour after midnight here...

    You'll definitely will get a good feel for the SX after having done some projects - I'm glad if my book can be of any help on that path.

    Maybe, you try to convert your BS-based mouse trap project into "plain SX". As a matter of fact, I had much fun reading your text on that!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-09 01:07
    I'm glad you found it amusing...And I was considering doing that very thing...But it seems like overkill...Although maybe that's just because I haven't got the·SX licked yet!· I will keep plugging along...What I'd like to see, and maybe it's out there, is a complete layout of the registers with their corresponding names/addresses as they apply to the assembler.

    Introductions to the various parts over time doesn't work well for me...I need to see everything at once, then break it down.· This doesn't work for most people, but it helped me make excellent use of the Z80 back in the day...I had looked over books here and there, but one day I ran across this book that was like a look inside, and everything was labeled as it's register's use in the assembler.· So once I had that down, as well as how each register worked, and it's various instructions and modes, I was able to start cranking out code and projects.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs
    ·
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-11 06:09
    G
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-11 06:49
    The SX docs suggest that the comparator module should be disabled in SLEEP in order to minimize current drain. However the data sheet does not expand on that point. That is an important parameter for micropower apps.

    Here is a rundown from experiment, where I applied voltage from two poteniometers to the comparator inputs, rb1 and rb2, and then put the chip into eternal SLEEP. (Caveat--observations based on one SX28 chip).

    The minimum comparator active current drain is about 110 microamps.
    -- both inputs must be near either Vss or Vdd
    -- the two inputs must be separated by a certain voltage--20 millivolts is enough.

    The current drain increases to ~1 milliamp when the two input voltages are equal (allowing for the input offset voltage), _and_ both near the rails. For example, both are at 0.1 volt or both are at 3.5 volts. The current is difficult to measure, as there is a tendency for self oscillation, 60hz pickup, etc.etc, when near the switching point.

    The surprising thing comes when either comparator input is near 1.8 volts, while the other one is near the rails. The current drain is around 2.5 milliamps. The current drain peak is narrow around that threshold. The current drain profile as a function of input voltage is pretty much the same as the profile when the comparator is disabled (That is why we never want to leave inputs floating!).

    If both inputs of the comparator are near the 1.8 volt level, the current drain can be as high as 4.5 milliamps, even if the voltage difference is enough to keep the comparator output solidly in one state or the other.

    The lesson here for anyone wanting to use the comparator and at the same time to minimize current drain, would be to keep the input voltage levels below 1.3 volts (or above 2.3 volts), and, to include at least 20 mV of hysteresis.

    I'll take a look tomorrow and see if the LVL or Schmitt registers have any effect on this. I don't think so, because of the earlier tests. It may be that there is a totem pole type of input circuit in the input structure of the comparator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • KenMKenM Posts: 657
    edited 2005-01-11 14:16
    Tracy,

    Just a brief note to say thank you for posting the work you are doing with the comparitor and current consumption.

    Ken
  • BeanBean Posts: 8,129
    edited 2005-01-11 14:45
    Yeah, Thanks. Are you going to put some SX info on your website ?
    Bean.
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-11 15:57
    Tracy Allen said...
    G
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-01-11 16:28
    Wow!· 2 of the top Parallax gurus working on scientific discovery in the name of knowledge!· Kind of profound!· I'm eager to see how this one plays out!

    smilewinkgrin.gif

    I think Gunther's idea might be somewhat akin to a circuit being switch by a Transitor, or FET...When the transistor or FET is switched off (Blocks the flow of electricity, so to speak) the current/work drops, since there is no work being done...At least it may be another interesting way of thinking about the differences...

    But Tracy, that was a good point.· I think the Water, being of a different form of matter, would certainly different properties in the same example.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Knight Designs
    324 West Main Street
    P.O. Box 97
    Montour Falls, NY 14865
    (607) 535-6777

    Business Page:·· http://www.knightdesigns.com
    Personal Page:··· http://www.lightlink.com/dream/chris
    Designs Page:··· http://www.lightlink.com/dream/designs


    Post Edited (Chris Savage) : 1/11/2005 4:35:25 PM GMT
  • danieldaniel Posts: 231
    edited 2005-01-11 16:41
    The statement still stands, assuming that the 'pump' is a centrifugal impeller type.· Other types of pump construction (e.g., displacement/piston pumps) would behave differently.

    One way of describing the process, without too much physics, is:

    Basically, the impeller 'works' by flinging the fluid away from the blade through the outlet; as the·fluid is flung away,·more fluid is 'drawn' into the intake.· When the conditions are such that the fluid surrounding the impeller becomes 'static'--not moving out because either the inlet or outlet are blocked--then the impeller just accelerates to the motor's maximum rpm as the the (remaining) trapped fluid just rotates with the impeller.· Now the 'work' the impeller is doing is just combatting friction, not accelerating fluid mass.


    HTH,

    Daniel
  • danieldaniel Posts: 231
    edited 2005-01-11 16:53
    BTW, my description does no violence to Tracy's water model of the inductor.·

    Daniel
  • James NewtonJames Newton Posts: 329
    edited 2005-01-11 20:47
    Bean said...
    Yeah, Thanks. Are you going to put some SX info on your website ?
    Bean.
    I hope I don't overstep my bounds, but I've already added all this good information from Tracey to sxlist.com:
    http://www.sxlist.com/techref/ubicom/analogcomparator.htm

    A VERY heart felt thanks to you sir for bothering to do the testing and for sharing it with us. I will, of course, remove my copies of your posts from sxlist.com if you request.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ---
    James Newton, Host of SXList.com
    james@sxlist.com 1-619-652-0593 fax:1-208-279-8767
    SX FAQ / Code / Tutorials / Documentation:
    http://www.sxlist.com Pick faster!



  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-01-11 22:34
    Daniel,

    thanks for that very clear and understandable explanation. I think the same explanation is valid for a fan "pumping" air as well, as a fan does not differ much from an impeller type liquid pump, and air is kind of "liquid" too, only more compressible.

    Actually, this discussion is a bit out of thread but it was initiated by my posting where I briefly described one of my current projects using the SX comparator. In the meantime, I have finished a prototype, and it will go into a real live test tomorrow.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2005-01-13 07:23
    I did evaluate the current drawn by the SX28 chip in SLEEP with the comparator module enabled. Comparator input rb2 is held at 0.5 volts, and rb1 is hooked to a precision variable voltage source (EXTECH CMM15 process calibrator). rb0 is enabled as the comparator output. All other sx28 pins are outputs low. Watchdog disabled. The sx28 is put to sleep. As I noted earlier, the minimum current is about 120 microamps. The graph below shows the current as the input voltage on rb1 is varied from zero up to 4.2 volts and back down to zero. The results are a lot more complicated than I was expecting, because there is hysteresis (different curve increasing vs decreasing). Also there are two high current peaks, one at 0.5 volts and one at 1.5 volts. Here is the graph:

    SX28comparatorSLEEP_IV.gif

    The blue curve is the trace followed on the way up, voltage on rb1 increasing. The red curve is the trace followed on the way down, voltage decreasing. The two curves split apart between 1 volt and 3.6 volts. The other two curves are short segments done to repeat the measurement.

    There is a peak of current, as expected at 0.5 volts, where the two comparator inputs are equal and the output rb0 makes its transition. The totem pole output of the comparator draws DC current at the mid point.

    There was also a peak of current at 1.5 volts. That was more surprising, because whatever is going on inside the chip has nothing to do with the comparator output. I would guess there is another totem pole structure that is biased on at that point, maybe connected with the standard SX input. By the way, this kind of peak in current is characteristic of the SX or PIC chip as the input voltage passes through the switching threshold. Keep that in mind as you use RCTIME!

    From the graph it appears that there is a big peak on the decreasing (red) curve at 1.5 volts, but not on the increasing (blue) curve. Don't count on that. On the blue curve I was stepping up by 0.1 volt units, and missed the peak. The peak is that narrow. On the way down, I decremented by 0.01 volt from 1.6 down to 1.4 volts, and that caught it.

    One conclusion: If you want to use the comparator and draw minimum current, too, then do the comparasons between 0 and 1 volt, and add positive feedback to keep away from the switching point.

    I have not yet tested with any care to see if these currents are affected by the setting of the LVL_B or Schmitt_B registers. I don't think so, but as you see, it is pretty complicated. I have no idea how to explain the hysteresis.

    By the way, thank you for your kind words about the investigation. James, please do add these numbers and the graph too if you please, to www.sxlist.com/techref/ubicom/analogcomparator.htm.

    Daniel, thank you for the great explanation of the physics of the impeller pump. I did listen to a vacuum cleaner and a hair dryer with the air flow blocked, and sure enough the pitch went up. I'm curious to hear the result of Gunther's comparator project. How about this: Take a sump pump and attach the outlet to a tall vertical pipe, so the pump pushes water up as far as it can. At that point, there is no flow, but it seems that the pump would be working "as hard as it can" to maintain the pressure head. But maybe not, as the blocked vacuum cleaner would by the same logic be "working as hard as it can" to maintain the vacuum.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.