0% found this document useful (0 votes)
20 views14 pages

Royal MPMC Encrypted

Uploaded by

Royal chodagiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views14 pages

Royal MPMC Encrypted

Uploaded by

Royal chodagiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

MPMC Mid-2 Que and Ans - ROYAL

1Q)Draw the architecture of 8051 and explain


A) 8051 Microcontroller Architecture
The 8051 microcontroller, a popular choice for embedded systems, boasts
a robust architecture that has stood the test of time. Let's delve into its key
components:
Central Processing Unit (CPU):
• 8-bit ALU: The Arithmetic Logic Unit (ALU) performs arithmetic and
logical operations on 8-bit data.
• Accumulator (ACC): An 8-bit register that holds data for arithmetic
and logical operations.
• Program Counter (PC): A 16-bit register that stores the address of the
next instruction to be executed.
• Instruction Register (IR): An 8-bit register that holds the current
instruction being executed.
• Stack Pointer (SP): An 8-bit register that points to the top of the
system stack.
• Data Pointer (DPTR): A 16-bit register used for addressing external
data memory.
Memory:
• 4KB ROM (Program Memory): Stores the program instructions.
• 128 Bytes RAM (Data Memory): Stores data for program execution.
• Special Function Registers (SFRs): A set of registers used to control
various peripherals like timers, serial ports, and interrupts.
Input/Output Ports:
• Four 8-bit I/O Ports (P0, P1, P2, P3): These ports can be configured as
input or output ports to interact with external devices.
Timers:
• Two 16-bit Timers/Counters: These timers can be used for generating
time delays, counting events, and controlling external devices.
MPMC Mid-2 Que and Ans - ROYAL
Serial Port:
• Full-Duplex Serial Port: This port enables serial communication with
other devices.
Interrupt System:
• Five Interrupt Sources: The 8051 supports five interrupt sources,
including two external interrupts, a timer interrupt, a serial port
interrupt, and an internal interrupt.
Clock Circuit:
• External Crystal Oscillator: An external crystal oscillator provides the
clock signal for the microcontroller.
Architecture Diagram:

MPMC Explanation:
• Memory-Mapped I/O: The 8051 uses memory-mapped I/O, where I/O
ports are mapped to specific memory locations. This simplifies I/O
operations as they are treated like memory accesses.
• Program Memory: The program memory stores the instructions that
the CPU executes.
• Data Memory: The data memory stores data used by the program,
including variables and temporary data.
MPMC Mid-2 Que and Ans - ROYAL
• Special Function Registers (SFRs): These registers control the various
peripherals of the microcontroller.
• Input/Output Ports: These ports allow the microcontroller to interact
with external devices.
• Timers: The timers can be used for generating time delays, counting
events, and controlling external devices.
• Serial Port: The serial port enables serial communication with other
devices.
• Interrupt System: The interrupt system allows the microcontroller to
respond to external events.
• Clock Circuit: The clock circuit provides the timing signals for the
microcontroller.
In essence, the 8051's architecture provides a powerful and flexible
platform for embedded system applications.

2Q)Draw the Pin-Diagram of 8051 and explain.


A)

8051 Microcontroller Pin Diagram


MPMC Mid-2 Que and Ans - ROYAL
Explanation of Pin Functions:
Power Supply Pins:
• VCC: This pin provides the positive power supply voltage, typically 5V.
• GND: This pin provides the ground reference.
Clock Oscillator Pins:
• XTAL1 and XTAL2: These pins are used to connect an external crystal
oscillator to provide the clock signal for the microcontroller.
Reset Pin:
• RESET: This pin is used to reset the microcontroller and initialize it to
its default state.
I/O Ports:
• Port 0 (P0): This 8-bit port is used for both I/O and lower-order
address/data bus multiplexing.
• Port 1 (P1): This 8-bit port is used for general-purpose I/O.
• Port 2 (P2): This 8-bit port is used for general-purpose I/O and some
special functions like external memory interfacing and interrupt
control.
• Port 3 (P3): This 8-bit port is used for general-purpose I/O, serial
communication, timer input, interrupt control, and other special
functions.
Control Signals:
• ALE (Address Latch Enable): This signal is used to latch the address
bus onto the lower order bits of Port 0 during external memory
access.
• PSEN (Program Store Enable): This signal is used to enable the
external program memory during program execution.
• EA (External Access Enable): This signal is used to enable or disable
external memory access.
Interrupt Pins:
• INT0 and INT1: These pins are used for external interrupt requests.
MPMC Mid-2 Que and Ans - ROYAL
• T0 and T1: These pins are used for timer input signals.
• RX and TX: These pins are used for serial communication.
In summary, the 8051 microcontroller's pin diagram reveals its versatile
capabilities for various applications. By understanding the functions of
each pin, you can effectively interface the 8051 with external devices and
implement complex systems.

3Q) Write notes on interfacing of a 4*4 matrix keyboard with 8051 mc in


MPMC
A) Interfacing a 4x4 Matrix Keyboard with 8051
How it Works:
1. Connect the Keyboard:
o Connect the keyboard's 8 pins to an 8-bit port on the 8051
(usually Port 1 or Port 2).
2. Scan the Keyboard:
o Row-wise:
▪ Make all rows output and set them high (1).
▪ Make one column input.
▪ Read the input column. If a key in that row is pressed, the
input will be low (0).
▪ Repeat for all rows.
o Column-wise:
▪ Make all columns output and set them high (1).
▪ Make one row input.
▪ Read the input row. If a key in that column is pressed, the
input will be low (0).
▪ Repeat for all columns.
3. Debouncing:
MPMC Mid-2 Que and Ans - ROYAL
o To prevent multiple keypresses from a single press, add a delay
after each reading. This ensures a stable reading before
processing.
4. Keypress Detection and Encoding:
o Once a keypress is detected, determine its row and column.
o Assign a unique code to each key based on its position.
8051 Program (Simplified):
Code snippet
; ... (Initialization code)

; Function to scan the keyboard and return the key code


SCAN_KEYPAD:
MOV R0, #0 ; Row counter
MOV R1, #0 ; Column counter

SCAN_ROW:
MOV P1, #0FH ; Set all rows as output, high
ORL P1, #R0 ; Set the current row as input
CALL DELAY ; Debounce delay
MOV R2, P1 ; Read the column inputs

CJNE R2, #00H, KEY_PRESSED ; If any key is pressed

INC R0 ; Increment row counter


CJNE R0, #4, SCAN_ROW ; Loop until all rows are scanned

RET ; No key pressed


MPMC Mid-2 Que and Ans - ROYAL

KEY_PRESSED:
; ... (Similar logic for column scanning and key code determination)
Key Points:
• Power Supply: Ensure both the keyboard and 8051 are powered
correctly.
• Pull-up Resistors: Use pull-up resistors on the input pins to prevent
floating inputs.
• Debouncing Delay: Adjust the delay to suit your specific keyboard
and application.
• Keypad Layout: Assign codes to keys based on your keyboard's
layout.
• Error Handling: Consider error handling for unexpected situations.
By following these steps and understanding the basic principles, you can
effectively interface a 4x4 matrix keyboard with an 8051 microcontroller.

4Q)Interfacing of 7 segment LED with 8051 microcontroller.


A) Interfacing a 7-Segment Display with 8051: A Simplified Guide
What You Need:
• An 8051 microcontroller
• A 7-segment display (common anode or common cathode)
• Resistors (for current limiting)
• Jumper wires
How to Connect:
1. Choose Your Display:
o Common Anode: Connect the common anode pin to Vcc (5V).
o Common Cathode: Connect the common cathode pin to
ground.
MPMC Mid-2 Que and Ans - ROYAL
2. Connect Segments:
o Connect each segment (a, b, c, d, e, f, g) of the display to
individual pins on an 8051 port (like Port 1).
3. Add Resistors:
o Connect a current-limiting resistor (e.g., 220 ohms) in series
with each segment to protect the LEDs.
How it Works:
1. Write a Program:
o Create a program for the 8051 to control the segments.
o Assign specific bit patterns to represent each digit.
o For example, to display '0', you might send the pattern 0x3F to
the port.
2. Send Data:
o The program sends the appropriate bit pattern to the port.
o The connected segments light up, forming the desired digit.
Simplified Example (Common Cathode):
Code snippet
; ... (Initialization code)

; Array to store segment patterns


SEGMENT_PATTERNS:
DB 0x3F, 0x06, 0x5B, 0x4F, 0x66
DB 0x6D, 0x7D, 0x07, 0x7F, 0x6F

DISPLAY_DIGIT:
MOV R0, #0 ; Index to access segment patterns
MOV R1, #DIGIT ; DIGIT is the digit to display
MPMC Mid-2 Que and Ans - ROYAL

MOV A, R1 ; Load the digit


DA A ; Convert to 7-segment code
MOV R0, A ; Use the converted value as the index

MOV A, @R0 ; Load the segment pattern


MOV P1, A ; Output the pattern to Port 1

CALL DELAY ; Delay to keep the digit visible

RET
Remember:
• The bit patterns for common anode and common cathode displays
are different.
• You can adjust the delay to control the display speed.
• For multiple-digit displays, you can use techniques like multiplexing.
By following these steps and understanding the basic principles, you can
effectively interface a 7-segment display with an 8051 microcontroller to
create various digital displays.

5Q) write a notes on programmable personal interface 8251 in MPMC


A) 8251: A Versatile Communication Interface
Introduction
The 8251, or Universal Synchronous Asynchronous Receiver Transmitter
(USART), is a programmable peripheral chip designed to facilitate serial
communication between devices. It can operate in both synchronous and
MPMC Mid-2 Que and Ans - ROYAL
asynchronous modes, making it a flexible choice for various
communication protocols.
Key Features:
• Synchronous and Asynchronous Operation: Supports both modes,
allowing for a wide range of communication scenarios.
• Programmable Baud Rate: The baud rate can be set to different
values to adjust the data transmission speed.
• Parity Generation and Checking: Ensures data integrity by adding a
parity bit to each byte.
• Error Detection: Detects errors like framing errors and overrun errors.
• Modem Control: Enables communication with modems for more
complex communication setups.
Functional Blocks:
1. Control Logic:
o Interfaces with the microprocessor to receive commands and
control signals.
o Configures the 8251's operation mode, baud rate, parity, and
other parameters.
o Monitors the status of the receiver and transmitter sections.
2. Receiver:
o Receives serial data from the communication channel.
o Performs bit synchronization and framing.
o Checks for errors and generates error flags.
o Stores received data in a buffer.
3. Transmitter:
o Accepts parallel data from the microprocessor.
o Converts parallel data into serial data.
o Adds parity bit and start/stop bits as required.
MPMC Mid-2 Que and Ans - ROYAL
o Transmits serial data to the communication channel.
Interfacing with a Microprocessor:
1. Address Decoding: Use the 8251's address lines to select it for data
transfer.
2. Control Word: Write a control word to the 8251's control register to
configure its operation mode, baud rate, parity, and other
parameters.
3. Data Transfer: Write data to the 8251's transmit data register to
transmit data serially.
4. Status Checking: Read the 8251's status register to check the status
of the receiver and transmitter.
5. Interrupt Handling: Configure the 8251's interrupt control to generate
interrupts for various events like data reception, transmission
completion, and errors.
Applications:
• Serial Communication: Connecting devices like printers, modems,
and other peripherals.
• Data Transfer: Transferring data between microcontrollers and other
devices.
• Remote Control: Implementing remote control systems for various
devices.
• Data Logging: Collecting and storing data from sensors and other
devices.
By understanding the 8251's architecture and programming capabilities,
you can effectively utilize it for a wide range of serial communication
applications.

6Q) write a notes on interfacing of Analog-to -digital conversation with 8086


microprocessor.
A) Interfacing an Analog-to-Digital Converter (ADC) with 8086
Microprocessor
MPMC Mid-2 Que and Ans - ROYAL
Understanding the Basics
An Analog-to-Digital Converter (ADC) is an electronic circuit that converts
an analog signal (continuous voltage or current) into a digital signal
(discrete values). An 8086 microprocessor, on the other hand, is a powerful
16-bit microprocessor that can execute instructions and process data.
Why Interface an ADC with 8086?
By interfacing an ADC with an 8086, we can:
1. Acquire Real-World Data: Measure physical quantities like
temperature, humidity, light intensity, etc., which are often analog in
nature.
2. Process and Analyze Data: The 8086 can process the digitized data,
perform calculations, and make decisions based on the input.
3. Control Devices: The 8086 can use the processed data to control
devices like motors, heaters, or displays.
Interfacing Steps:
1. Choose an ADC:
o Consider factors like resolution, speed, and interface type
(parallel or serial).
o Popular choices include the ADC0808, ADC0804, and higher-
resolution ADCs.
2. Connect the ADC to 8086:
o Control Signals: Connect the ADC's control signals (start
conversion, end of conversion, chip select, etc.) to the 8086's
I/O ports or a dedicated I/O port expander like the 8255.
o Data Lines: Connect the ADC's data output lines to the 8086's
data bus.
o Power Supply: Ensure both the ADC and 8086 are powered with
the same voltage supply.
3. Write 8086 Assembly Code:
MPMC Mid-2 Que and Ans - ROYAL
o Initialize the ADC: Send appropriate control signals to the ADC
to initiate the conversion process.
o Wait for Conversion Completion: Poll the end-of-conversion
signal from the ADC.
o Read the Digital Data: Read the digital output from the ADC's
data lines.
o Process the Data: The 8086 can then perform calculations,
comparisons, or other operations on the digitized data.
Example: Interfacing ADC0808 with 8086
1. Connect the ADC:
o Connect the ADC's control signals (CS, RD, WR, INT) to the
8255's port C.
o Connect the ADC's data output lines (DB0-DB7) to the 8255's
port A.
2. Write 8086 Assembly Code:
Code snippet
; ... (Initialization code)

; Send start conversion pulse


MOV AL, 01H ; Set bit 0 of port C high
OUT 0C8H, AL

; Wait for end of conversion


WAIT_LOOP:
IN AL, 0C9H ; Read port C
TEST AL, 01H ; Check if bit 0 is high
JNZ WAIT_LOOP
MPMC Mid-2 Que and Ans - ROYAL
; Read the digital data
IN AL, 0C9H ; Read port A (data from ADC)

; Process the digital data


; ...

Key Considerations:
• Noise Reduction: Use proper grounding techniques and shielding to
minimize noise in analog signals.
• Power Supply Decoupling: Use capacitors to filter out noise in the
power supply.
• Timing and Synchronization: Ensure proper timing and
synchronization between the 8086 and the ADC.
• Error Handling: Implement error checking mechanisms to handle
potential issues like conversion errors or data corruption.
By following these steps and considering the key factors, you can
successfully interface an ADC with an 8086 microprocessor to build a wide
range of data acquisition and control systems.

You might also like