I am wondering if a logic gate would be of use to a circuit that contains a micro-controller.Are there cases when an analog logic gate is preferred over a micro-controller and what are some of the gadgets that use analog logic gates in the age of micro-processors and controllers.
I think you mean a 'discrete' logic gate.
Yes, there are reasons you may wish to use an external gate. I'll take an actual example: I have a microcontroller that controls a clock signal to some external boxes. It must turn the clock (several MHz) on at a time determined by the microcontroller and must not feed out any 'runt' pulses. By synchronizing the enable with the clock generator (a flip-flop) and gating it (an 'and' gate), the specifications can be met. There's no way to do it with just the micro.
In another case, an external signal from a comparator should be enabled by a timer in the microcontroller. The microcontroller peripheral has the ability to precisely (in time) toggle its port pin, but no ability to 'and' signals with that pin state.
In some cases, microcontrollers have been fitted with some configurable logic to take care of this sort of requirement (the 'CLC' or 'configurable logic cell') on Microchip parts, for example), but there will always be applications where the micro maker did not anticipate the application. In fact, sometimes we tie an entire FPGA with hundreds of thousands of gates to the micro to get enough external logic to meet the requirements.
Digital logic gates ("analog logic gate" makes no sense) are still sometimes used with microcontrollers. Usually the reason is that something needs to be done at the speed of a logic gate that firmware is too slow for. Another possibility is expanding the I/O capabilities of the micro. If you have several devices on a bus, for example, you will probably have external logic that latches data to and from the bus. There may also be external logic to handle arbitration, since this often has to happen at the speed of bus cycles or fractions of a bus cycle.
Microchip has determined that enough designers need to add some peripheral "glue" logic to their designs that they have come out with two microcontroller families -- PIC16(L)F150 and PIC10(L)F32X -- which include up to four Configurable Logic Cells (CLC), much like a miniature CPLD.
There are eight different logic functions available:
• AND-OR • OR-XOR • AND • S-R Latch • D Flip-Flop with Set and Reset • D Flip-Flop with Reset • J-K Flip-Flop with Reset • Transparent Latch with Set and Reset
For example here is a J-K flip-flop:
In the case of the PIC10 (which has one CLC), that's pretty amazing for a six-pin device that costs under 40ȼ in quantity. At that price, the cost and space saving over having to include several separate logic chips adds up.
On one hand, "discrete" logic can perform faster and more reliably operations that could otherwise be done by a microcontroller. And, which sometimes is even more important, logic gates can operate concurrently, while a uC is inherently sequential.
Also, if you have a crowded board you can save I/O pins on the microcontroller if you can perform such operations externally.
To add to the list of applications, they're also useful when dealing with input signals faster than you could process directly in the microcontroller. For instance, on a board I'm working on at the moment, a phase detector - simply an XOR gate - with a resistor and capacitor allows the MCU to read out the relative phase of two signals using its ADC, instead of having to sample the whole high speed signal.
Everybody has ignored op-amps here; analogue logic has many functions even in modern uP / micro controller circuits. Proprietary signals via long wires between micros would be just one application. Personally I work on security and other electronics all the time where I have to sort out bad designs by highly qualified Engineers because of their lack of understanding of op-amps and discreet logic.
They are also used for safety logic, to keep the whole complexity of software out of the critical path. In this laser cutter board for example, to turn off the laser.