MPMC
MPMC
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
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
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.
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.