MP Unit4 Notes
MP Unit4 Notes
• Implemented using software loops and instructions like NOP (No Operation).
• Less precise and CPU-intensive.
• Suitable for simple applications where accuracy is not critical.
(B) Hardware Timers:
• Measures the frequency of an incoming signal by counting pulses within a xed time.
• Used in digital frequency meters.
(C) Real-Time Clock (RTC) Implementation
• Data Bus Buffer: Interfaces with the microprocessor for data transfer.
• Read/Write Logic: Handles communication between the CPU and timer.
• Control Word Register: Stores mode settings and con gurations.
• Three Independent 16-bit Counters:
◦ Each counter operates separately and can be programmed in different modes.
◦ Accepts a clock input and generates an output signal based on the programmed
mode.
3. Interfacing 8253/8254 with Microprocessors
Pins and Signals of 8253/8254
Pin Function
CLK Clock input signal for timing operations.
GATE Enables or disables the counter.
OUT Output signal generated based on timer mode.
RD Read signal to access timer registers.
WR Write signal to load data into the timer.
CS Chip select to activate the timer.
D0-D7 Data bus lines for communication with the CPU.
A0, A1 Address lines to select counters or control registers.
Addressing 8253 in an 8085 Microprocessor System
• Counter 0 → Address X
• Counter 1 → Address X+1
• Counter 2 → Address X+2
• Control Register → Address X+3
Control Word Format for 8253
To con gure the timer, a control word is written to the control register.
Bit 7 6 5 4 3 2 1 0
Function SC1 SC0 RL1 RL0 M2 M1 M0 BCD
Solution:
• Three independent 16-bit counters, each con gurable for different timing operations.
• Operates in six different modes, including delay generation, frequency division, and square
wave generation.
• Supports binary and BCD counting.
• Works with microprocessors like 8085 and 8086.
• Used for real-time clocking, event counting, and interrupt generation.
Pin Diagram of 8253
Pin Description
D0-D7 8-bit data bus for communication with CPU.
CLK (Clock Input) Provides the clock signal for the timer.
GATE (Gate Input) Controls the counter operations (start/stop).
OUT (Output Signal) Provides the timer output.
RD (Read Signal) Reads the counter value.
WR (Write Signal) Loads data into the counter.
CS (Chip Select) Selects the timer for communication.
A0, A1 (Address Lines) Selects counters or control register.
fi
2. Modes of Operation in 8253
The 8253 operates in six different modes, each serving a unique purpose in microprocessor-based
applications.
• The counter continuously reloads the initial value after reaching zero.
• OUT toggles high and low periodically, generating a xed frequency.
• Used for clock signal generation.
Mode 3: Square Wave Generator
• Similar to Mode 2, but the OUT signal produces a symmetrical square wave.
• Used in frequency division and tone generation.
Mode 4: Software Triggered Strobe
• The counter counts down to zero, and OUT goes high momentarily.
• Used for pulse generation applications.
Mode 5: Hardware Triggered Strobe
• Counter 0 → Address X
• Counter 1 → Address X+1
• Counter 2 → Address X+2
• Control Word Register → Address X+3
Control Word Format for 8253
To con gure the timer, a control word is sent to the control register.
fi
fi
Bit 7 6 5 4 3 2 1 0
Function SC1 SC0 RL1 RL0 M2 M1 M0 BCD
• SC1, SC0: Select the counter (00 → Counter 0, 01 → Counter 1, 10 → Counter 2).
• RL1, RL0: Select read/write mode (Latch, LSB, MSB, or Both).
• M2, M1, M0: Select one of the six operating modes.
• BCD: 0 → Binary counting, 1 → BCD counting.
Interfacing Circuit of 8253 with 8085
1. Connect the data bus (D0-D7) of 8253 to the data bus of 8085.
2. Use address lines A0, A1 to select different counters.
3. Connect CS, RD, WR signals to the microprocessor for control.
4. Provide clock and GATE inputs to control the counting process.
Example: Generating a 10 ms Delay Using 8253 in 8085
Microprocessors and digital systems cannot process analog signals directly. ADCs are used to:
1. Resolution – The number of bits in the digital output (e.g., 8-bit, 10-bit, 12-bit ADC).
2. Sampling Rate – The rate at which the ADC samples the input signal.
3. Conversion Time – The time taken to convert an analog signal to digital.
4. Quantization Error – The error due to approximating continuous values with discrete
levels.
5. Input Range – The voltage range that the ADC can handle.
2. Types of ADC Converters
There are several methods used for Analog-to-Digital conversion. The most commonly used ADC
types are:
• Uses a Successive Approximation Register (SAR) to approximate the input signal step-
by-step.
• Provides a balance between speed and accuracy.
• Used in microcontrollers and industrial applications.
Working of SAR ADC:
• Integrates the input signal over a xed period, then converts it into a digital value.
• Used in high-precision applications, such as digital multimeters.
• Slower but highly accurate and noise-resistant.
Pros: High accuracy, good for low-speed measurements.
Cons: Slow conversion rate.
4. Sigma-Delta ADC
5. Pipeline ADC
4. Applications of ADC
1. Microcontrollers & Microprocessors – Interface with sensors (temperature, pressure,
light).
fi
fi
fi
fi
2. Medical Equipment – ECG, MRI, and digital X-rays use ADCs for signal conversion.
3. Audio Processing – Converts analog sound waves into digital signals (used in MP3s,
microphones).
4. Oscilloscopes & Measurement Devices – Convert voltage waveforms into digital data.
5. Communication Systems – Used in modems and radio transmission for signal processing.
◦ The ADC internally approximates the input voltage and converts it into an 8-bit
binary output.
◦ The EOC (End of Conversion) pin goes HIGH when conversion is complete.
4. Reading Digital Output
◦ The OE (Output Enable) pin is set HIGH to read digital data on D0–D7 pins.
5. Reset for Next Conversion
◦ The START pin is set LOW, and a new analog value is given to the input for the
next conversion cycle.
4. Interfacing ADC 0808/0809 with 8085 Microprocessor
Connections Required:
1. Select the Analog Input Channel (if using a multiplexer-based ADC like ADC0808/0809).
2. Start the Conversion by sending a pulse to the START pin.
3. Wait for the Conversion to Complete by checking the EOC (End of Conversion) signal.
4. Read the Digital Data from the ADC output pins D0-D7 after enabling the OE (Output
Enable) signal.
5. Reset the ADC for the Next Conversion Cycle.
◦ The microprocessor resets the START pin for the next analog input.
◦ The next analog signal is processed in the same manner.
3. Medical Equipment
4. Summary
• ADC is essential for interfacing real-world analog signals with microprocessors.
• ADC 0808/0809 are widely used 8-bit ADCs with an 8-channel multiplexer.
• Interfacing requires control signals (START, EOC, OE) and an 8-bit data bus.
• Applications include sensor interfacing, industrial automation, medical devices, audio
processing, and communication systems.
Understanding ADC interfacing is crucial for designing embedded systems, IoT devices, and
real-time monitoring applications.
fi