From SR Latch to Microcontroller I/O Pin Introduction
Other than voltage-current levels a CMOS OR, NOR, AND, NAND, XOR gates operate identically to their TTL cousins. Note: CMOS and TTL can't be directly connected to each other unless the same voltage without some form of level translation circuits. I'll be addressing that issue in other pages..
In my pages Tutorial NOR Gate SR Latch Circuits and Tutorial NAND Gate SR Latch Circuit I introduce how to use SN74LS02 NAND gates and SN74LS00 NAND gates respectively construct a basic digital flip-flop, SR latch, and D-flip-flop.
The above circuit in Fig. 2 is built from NAND or NOR gates. It's also called a one-bit data latch. While the internal construction differs the function is identical: store one bit of data when the voltage on the CLK pin changes.
If the Q output is HIGH then the !Q output is LOW and vice-versa. It will remember the last condition until changed or power is removed.
These flip-flop type circuits are the basis of all modern computers and micro-controllers. Modern micro-controllers have internal memory often flash for program storage, EEPROM, and static scratchpad RAM. Some require an external oscillator crystal.
All have programmable Input-Output pins. Fig. 1 illustrates a single I/O pin on a Microchip PIC16F84A. By writing binary data to specific static memory locations we setup hardware modules and configuration of the I/O pins.
Microchip PIC which stands for Peripheral Interface Controller have many variations from basic to super powerful. Can also be programmed in C or assembly through software known as MPLAB from Microchip.
Positive: price and flexibility.
Negatives: must be compiled and uploaded through a separate PIC programmer. The C in MPLAB is copyrighted (I think). I never use C on basic low end devices. I use assembly for that.
Assembly requires a lot of knowledge of the particular controller along with electronics. Not for beginners.
It uses three D-flip-flops similar to those constructed from NAND and NOR gates. Q1 and Q2 are MOSFETs or metal-oxide field effect transistors. They are voltage operated and in this case can "source" or "sink" 25 milliamps (mA) or 0.025 amps.
The configuration is known as Tri-State. The I/O pin can be HIGH, LOW, or floating (Hi-Z).
While this is connected in a Tri-State configuration the following webpage introduces this circuit as a non-tri-state power driver or buffer circuit in Fig. 3. It also illustrates the concept of sink-source connections.
Know the concepts of sink and source!
As a quick note I'll assume a 5-volt circuit. A HIGH or binary 1 is 5-volts, a LOW or binary 0 is 0-volts. Current flow is assumed to be from positive to negative.
Also see the following on MOSFET transistor switches. Yes there are two basic types that differ by direction of current flow.
- Tutorial NOR Gate SR Latch Circuits
- Tutorial NAND Gate SR Latch Circuit
- Basic Digital Circuits Tutorials
- High current TTL MOSFET Driver Circuit
- Non-Inverting Tri-State Buffer-Switch Demo Circuit
- Review Connecting Digital Logic and Transistors
- From SR Latch to Microcontroller IO Pin Introduction
- Transistor-MOSFET Switch Circuit with Optocouplers
- High Voltage Optocoupler Tri-State Switching Circuits
- Optocouplers for TTL-CMOS Logic Level Shifting
- Basic TTL Tri-State Buffer Circuit Example 1
- Basic TTL Tri-State Buffer Circuit Example 2
- Transistor Output Non-Inverting Tri-State Switch
- Transistor Output Inverting Tri-State Switch
- Tutorial OR-NOR Circuits Including Monostable Multivibrator
- Introduction to RC Differentiator Circuits and Uses
- Brief Tutorial of XOR and XNOR Logic Gates
- Simple Schmitt Trigger SN7414 Square Wave Generator
- SN7414 Square Wave Generator uses SN7476 JK Flip-Flop
- Three Output Pulse Generator Circuit for Digital Circuits
- Geiger Counter Adventures in Radioactivity
- Introduction to Geiger-Mueller Counters and Electronics
- Astable CD4047 Geiger Counter Power Supply
- CD4047 Monostable Multivibrator Circuit
- Getting Real About Radiation Myths and Hazards
- Uranium Hype-Facts and Virginia Uranium
- Uranium Basics and Isotopes
- Climate Change, Climate Scams, and Volcanoes