The Newest LEICA Q2 - Ready for Pre-Order

Microcontrollers- Part 5 : The Analog Comparator

  Microcontrollers – Part 5 : The Analog Comparator

    It’s time to meet again with our little friend: CPU Monkey – the “manager” of all processes into our virtual Microcontroller.

   Today CPU Monkey will use the Analog Comparator. It will be a Heavy work …

   Example: The CPU Monkey will measure the analog signals – the weights of many eggs, using another principle than last time described ADC, Namely, using the Analog Comparator mechanism. 

   Is It Sounds too simple?  Or It Sounds sophisticated?  No, it doesn’t.  The truth isn’t between or in some limits. The truth is in the knowledge.

   Let we begin with some theory.

ac-2-hardware-pro

PIC. 1  Is the Analog Comparator equal to 1-BIT ADC? The answer you can find below in the text

   Let’s remember, what the signals are?

   Signals: There is Analog and Digital Signals but they are nothing more than the way of representation of the Physical characters of processes.

   Almost any Single-Chip Microcontroller has the ANALOG Comparator Circuitry on-chip. The main purpose of such comparing module into the real MCU is the ability to compare two analog magnitudes.

   Some “DRY” Theory:  

    Generally, Each Analog Comparator consists two ANALOG Inputs: +Positive and -Negative, and Analog Output. We say “Analog Output”, because theoretically, the output is an Analog.

ac-1f-hardware-pro

PIC. 2  The Schematic Symbol, Style of Work, The hysteresis 

   The schematic symbol is a triangle with Positive and Negative Inputs and one Output.

EQUATION 1.        U out =  {  U[+Positive Input]  –  U[-Negative Input]  } *  The Comparator’s Analog Gain [ A ]

   Without any Feedback resistors, the gain is maximal: few million times. It means if the comparator’s positive input has an applied the measured voltage, and the negative input is “propped” on the fixed, stable in time voltage, known as “The reference voltage”, similar to the max range reference voltage in the ADC theory.

   It means if the comparator’s positive input has an applied the voltage within even a part of millivolt higher than the “reference voltage” applied on a comparator’s negative input.

   Then, the result according to the EQUATION 1. will be: the Comparator output pin will reach the maximal possible positive (+supplying voltage) – also named: Output reaches the positive “rail” limited by the amplitude of the Powering source voltage.  Then, we said on an electronic slang: The comparator output is saturated.

   For a funny Describing and Representing the Analog Comparator, the CPU Monkey Has on the virtual MCU’s Table the mechanical old-fashioned metallic Scales – two weights Comparator.

   In one Plate of the scale, the CPU monkey will place the standardized weights and

 

ac-1-hardware-pro

PIC. 3   Analog Comparator – The Schematic Symbol

 

   Example: Analog comparator has the following parameters:

   Supplying voltage: 5V Vcc;

   Max Input Voltage:  5V + 0.5V;

   Min Input Voltage :  0V – 0.5V;

   Comparator open-loop Gain ;

   Without applied feedback (also known as an open-loop operation), the discrete analog comparator has the Gain equal a few million times.

   As we already said It means: the comparator’s output is saturated.

 

   Practical Example and virtual MCU program explanation:

   Basis: The CPU Monkey has:

  • An analog, mechanical scales – {It representing the Analog Comparator circuitry},
  • The etalon mass, representing the etalon’s egg weight. {The Association with the reference Voltage applied to the negative comparator’s input.},
  • A Huge quantity of “to be tested” eggs. {It representing the Analog input voltage applied to the Positive comparator’s  input }.

   GOAL: The CPU Monkey will compare the weight of a great count of eggs with a taken for the etalon large egg’s mass.

   The eggs with a mass lower than the etalon one will be separated in the “little-sized eggs Box”.

   The heavier eggs then the etalon egg mass will be separated in “normal-sized eggs Box”

   The scales’ tail is representing the comparator’s output.  When the weight (analog signal amplitude) of the checked/compared member is more than the etalon weight, the scales tail is going upwards – similar the discrete analog comparator unit.

   The CPU Monkey quickly inserting egg after egg, and, dependingly the Scales comparing result, filling the two boxes.

   Without any troubles, we are finishing our “next virtual program”. 

cpu-monkey-1-hardware-pro

Little CPU Monkey

   Now, non-exhausted, CPU Monkey can go to rest – MCU stays into the IDLE State.

   It is important to say, the analog comparator has some benefits versus the Analog to Digital converter.

   Firstly, the analog comparator has a more noiseless operation.

   Second: The POWER consumption is negligible. This is the reason Our friend little CPU Monkey not to be tired.

   Analog Comparator has very quick and a predictable manner of work. The program code is simpler. 

   Let’s say and another Interesting thing:

   Our friends by Microchip have been made into their children:  PIC MCU’s The “Sophisticated” Analog comparator with a mechanism to… adjust the reference voltage.

   It is very useful to “scan the near limits, using such variable reference – the system work as using the conventional ADC, but without its disadvantages.

   Using the Analog Comparator engine, the developers can see here are some disadvantages

   Many MCU’s has a little count – generally, only one analog comparator unit.

   If the analog applied voltage on the positive analog comparator’s input isn’t too close to the threshold point, defined by the reference voltage – the MCU  don’t know exactly the magnitude of the measuring unit – just up or down the limit is. 

   As a whole, the Analog Comparator allows creating simple and durable programs.

 

To Be Continued!

Don’t Stop To Reinvent Yourself, Dear Explorers!

 

Leave a Reply