0% found this document useful (0 votes)
18 views

MPMC

MPMC

Uploaded by

yfood085
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)
18 views

MPMC

MPMC

Uploaded by

yfood085
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/ 17

ASSIGNMENT – 5

Shubhangi Shubhra
21BKT0096
1) Write an 8051 program to get data from port P0 and send it to port
P1 continuously while an interrupt will do the following: Timer 0 will
toggle the P2.1 bit every 100 microseconds.
CODE
ORG 0000H
LJMP MAIN
ORG 000BH
CPL P2.1
RETI
ORG 0030H
MAIN:
MOV TMOD,#02H
MOV P0,#0FFH
MOV TH0,#0A4H
MOV IE,#10000010B
SETB TR0
BACK: MOV A,P0
MOV P1,A
SJMP BACK
END
2) Write an 8051 program to get data from a single bit of P1.2 and send
it to P1.7 continuously while an interrupt will do the following: A serial
interrupt service routine will receive data from a PC and display it on P2
ports
CODE
ORG 0000H
LJMP MAIN
ORG 0023H ; ----serial interrupt vector table
LJMP SERIAL
ORG 0030H ;-- after vector table space
MAIN:SETB P1.2 ; -- P1.2 made as input pin
MOV TMOD,#20H ; -- timer 1 mode 2
MOV TH1,#-3 ;-- set baud rate 9600
MOV SCON ,#50H ; -- one stop bit
MOV IE,#10010000B ; -- serial int. enabled.
SETB TR1 ;-- Timer 1 stared.
BACK:MOV C,P1.2
MOV P1.7,C
SJMP BACK
SERIAL:JB TI,TRANS
MOV A,SBUF
MOV P2,A
CLR RI
RETI
TRANS:CLR TI
RETI
END
OUTPUT
3)Write an assembly level program to display your roll number on LCD
which is interfaced with an 8051 microcontroller.
CODE
; Program to display roll number "21BKT0096" on LCD
; 8051 assembly program

ORG 0H
START:
ACALL LCDINIT ; Initialize LCD
ACALL GETKEY
AGAIN:
SJMP AGAIN
; LCD Initialization Subroutine
LCDINIT:
MOV A, #38H ; Initialize LCD in 8-bit mode, 2 lines, 5x7 matrix
ACALL COMNWRT ; Call command write subroutine
ACALL DELAY ; Give LCD some time
MOV A, #0EH ; Display on, cursor on
ACALL COMNWRT ; Call command write subroutine
ACALL DELAY ; Give LCD some time
MOV A, #01 ; Clear LCD
ACALL COMNWRT ; Call command write subroutine
ACALL DELAY ; Give LCD some time
MOV A, #06H ; Shift cursor right
ACALL COMNWRT ; Call command write subroutine
ACALL DELAY ; Give LCD some time
MOV A, #080H ; Move cursor to beginning of first line
ACALL COMNWRT ; Call command write subroutine
ACALL DELAY ; Give LCD some time

; Display roll number "21BKT0096" on LCD


MOV A, #'2' ; Display '2'
ACALL DATAWRT
ACALL DELAY
MOV A, #'1' ; Display '1'
ACALL DATAWRT
ACALL DELAY

MOV A, #'B' ; Display 'B'


ACALL DATAWRT
ACALL DELAY

MOV A, #'K' ; Display 'K'


ACALL DATAWRT
ACALL DELAY

MOV A, #'T' ; Display 'T'


ACALL DATAWRT
ACALL DELAY

MOV A, #'0' ; Display '0'


ACALL DATAWRT
ACALL DELAY

MOV A, #'0' ; Display '0'


ACALL DATAWRT
ACALL DELAY
MOV A, #'9' ; Display '9'
ACALL DATAWRT
ACALL DELAY

MOV A, #'6' ; Display '6'


ACALL DATAWRT
ACALL DELAY

RET

; Command Write Subroutine


COMNWRT:
MOV P1, A ; Send command to Port 1
CLR P2.0 ; RS = 0 for command
CLR P2.1 ; RW = 0 for write
SETB P2.2 ; Enable LCD
ACALL DELAY ; Short delay
CLR P2.2 ; Disable LCD
RET

; Data Write Subroutine


DATAWRT:
MOV P1, A ; Send data to Port 1
SETB P2.0 ; RS = 1 for data
CLR P2.1 ; RW = 0 for write
SETB P2.2 ; Enable LCD
ACALL DELAY ; Short delay
CLR P2.2 ; Disable LCD
RET

; Delay Subroutine
DELAY:
MOV R3, #50 ; Outer delay loop
HERE2:
MOV R4, #255 ; Inner delay loop
HERE:
DJNZ R4, HERE ; Decrement inner loop counter
DJNZ R3, HERE2 ; Decrement outer loop counter
RET

; Keyboard Subroutine to Get Key Pressed


GETKEY:
MOV P0, #0FH
REP:
MOV P0, #0FH
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, OVER
SJMP REP
OVER:
ACALL DELAY
MOV P0, #0FH
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, OVER1
SJMP REP
OVER1:
CLR P0.4 ; Row 0 selected
SETB P0.5
SETB P0.6
SETB P0.7
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, ROW0
CLR P0.5 ; Row 1 selected
SETB P0.7
SETB P0.6
SETB P0.4
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, ROW1
CLR P0.6 ; Row 2 selected
SETB P0.7
SETB P0.5
SETB P0.4
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, ROW2
CLR P0.7 ; Row 3 selected
SETB P0.4
SETB P0.6
SETB P0.5
MOV A, P0
ANL A, #0FH
CJNE A, #0FH, ROW3
SJMP REP

MOV R0, #04H


ROW0:
MOV DPTR, #KCODE0
SJMP FIND
ROW1:
MOV DPTR, #KCODE1
SJMP FIND
ROW2:
MOV DPTR, #KCODE2
SJMP FIND
ROW3:
MOV DPTR, #KCODE3
FIND:
RRC A
JNC MATCH
INC DPTR
DJNZ R0, FIND
MATCH:
MOV A, #084H ; Display pressed key
ACALL COMNWRT
ACALL DELAY
CLR A ; Set A=0 (match is found)
MOVC A, @A+DPTR ; Get ASCII from table
ACALL DATAWRT
ACALL DELAY
LJMP REP ; Loop to read the next key

; ASCII Look-Up Table for Each Row


ORG 300H
KCODE0: DB 'F', 'B', '8', '4' ; Row 0
KCODE1: DB 'E', 'A', '7', '3' ; Row 1
KCODE2: DB 'D', '0', '6', '2' ; Row 2
KCODE3: DB 'C', '9', '5', '1' ; Row 3
END
STIMULATION

4) Discuss any one security-based project with suitable block diagram


and code (pseudo code or just logic) which can be designed and
implemented (used) in our college campus.
Project Title: Smart Access Control System Using RFID and
Microcontroller
1. Project Overview
In a college campus, ensuring secure access to buildings, labs, and
restricted areas is paramount. A Smart Access Control System using
RFID (Radio Frequency Identification) and a microcontroller offers an
efficient and scalable solution. This system verifies the identity of
individuals attempting to enter a secured area by reading their RFID
tags and granting or denying access based on pre-stored credentials.

2. Block Diagram
Below is the block diagram illustrating the main components and their
interactions within the Smart Access Control System:
Block Diagram Description:
1. RFID Reader Module: Scans and reads the unique ID from the RFID
tag/card.
2. Microcontroller Unit (e.g., Arduino, PIC, or 8051): Processes the
RFID data, compares it with stored credentials, and controls the
access mechanism.
3. Database/Memory Storage: Stores authorized RFID IDs and
possibly user information.
4. Access Mechanism (Servo Motor/Electromagnetic Lock): Grants or
denies physical access based on microcontroller commands.
5. Display Module (LCD/LED): Provides feedback to the user (e.g.,
"Access Granted" or "Access Denied").
6. Power Supply: Powers all components of the system.
7. Buzzer/Alarm: Optional component to signal unauthorized access
attempts.

3. System Functionality
1. Initialization:
o System powers up and initializes all modules.
o Microcontroller loads the list of authorized RFID IDs from
memory.
2. RFID Scanning:
o User presents their RFID tag/card to the RFID reader.
o RFID reader scans and retrieves the unique ID from the tag.
3. Authentication:
o Microcontroller receives the scanned RFID ID.
o It compares the scanned ID with the stored authorized IDs in
the database.
4. Access Decision:
o If ID is authorized:
 Activate the access mechanism (e.g., open door via
servo motor).
 Display "Access Granted" on the LCD.
 Optionally, log the access event.
o If ID is unauthorized:
 Deny access by keeping the door locked.
 Display "Access Denied" on the LCD.
 Optionally, activate a buzzer or alarm.
5. Reset:
o After a predefined duration, reset the system to allow the
next access attempt.

4. Components Required
1. Microcontroller: Arduino Uno (for ease of use) or any suitable
microcontroller like PIC or 8051.
2. RFID Reader Module: MFRC522 RFID Module.
3. RFID Tags/Cards: For authorized users.
4. Servo Motor or Electromagnetic Lock: For controlling door access.
5. LCD Display: 16x2 LCD for status messages.
6. Buzzer: For audio alerts on unauthorized access.
7. LEDs: Optional indicators for status.
8. Power Supply: 5V power adapter or batteries.
9. Resistors, Wires, and Breadboard: For connections.
10. Optional: Real-Time Clock (RTC) module for logging access
times.

5. Pseudo Code / Logic


Below is the pseudo code outlining the logic of the Smart Access
Control System:
CODE
BEGIN
Initialize RFID Reader
Initialize LCD Display
Initialize Servo Motor
Initialize Buzzer
Load Authorized RFID IDs into Memory

LOOP FOREVER
IF RFID Reader detects a tag
Read RFID ID from the tag
DISPLAY "Scanning..." on LCD
IF RFID ID is in Authorized IDs
DISPLAY "Access Granted" on LCD
Activate Servo Motor to unlock door
OPTIONAL: Log access with timestamp
Wait for a few seconds
Deactivate Servo Motor to lock door
ELSE
DISPLAY "Access Denied" on LCD
Activate Buzzer for alert
Wait for a few seconds
Deactivate Buzzer
END IF
END IF
DELAY for a short duration
END LOOP
END
6. Implementation Steps
1. Hardware Setup:
o Connect RFID Module to the microcontroller (e.g., Arduino).
o Connect LCD Display to the microcontroller using appropriate
pins.
o Connect Servo Motor/Electromagnetic Lock to the
microcontroller's PWM pin.
o Connect Buzzer and LEDs for audio and visual indicators.
o Ensure Proper Power Supply to all components.
2. Programming the Microcontroller:
o Initialize all peripherals (RFID, LCD, Servo, Buzzer).
o Create a database of authorized RFID IDs within the code or
external memory.
o Implement the authentication logic as outlined in the pseudo
code.
o Handle access mechanisms based on authentication results.
o Provide user feedback through LCD and buzzer.
3. Testing:
o Verify RFID Scanning by testing with authorized and
unauthorized tags.
o Check Access Mechanism activation and deactivation.
o Ensure Proper Feedback on the LCD and buzzer.
o Refine Delays and Timing for smooth operation.
4. Deployment:
o Mount the system at the entrance of the secured area.
o Ensure all connections are secure and components are
protected.
o Conduct a security audit to test the system's reliability and
robustness.
9. Conclusion
The Smart Access Control System using RFID and a microcontroller is a
practical and impactful project for enhancing campus security. It
leverages readily available components and provides a foundation for
further advancements in secure access technologies. By implementing
this system, colleges can ensure that only authorized individuals gain
access to sensitive areas, thereby maintaining a safe and secure
environment.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy