|
A 4-floor building elevator where multiple people can press call buttons simultaneously. The elevator must decide which floor to service first based on priority (higher floor = higher priority, mimicking real elevator logic), and show whether the elevator is idle or moving.
Inputs: 4 single-bit floor call buttons: B4, B3, B2, B1 (B4 = 4th floor, ..., B1 = 1st floor). 1 = pressed, 0 = not pressed.
Logic:
* If multiple buttons are pressed, the highest floor number gets priority (standard priority encoder behavior).
* Output the selected floor number in 2-bit binary (00 = floor 1, 01 = floor 2, 10 = floor 3, 11 = floor 4) on 2 LEDs.
* An "Elevator Moving" LED turns ON if at least one button is pressed; turns OFF (idle) if no buttons are pressed.
* Additionally, a "Multiple Requests" LED turns ON if 2 or more floors are requesting simultaneously (useful for a dispatch/queue indicator).
Sample Input: B4=0, B3=1, B2=0, B1=1
Output: Floor priority = 3rd floor → LEDs show 10; Elevator Moving = ON; Multiple Requests = ON (since B3 and B1 both pressed).
Sample Input: B4=0, B3=0, B2=0, B1=0
Output: LEDs show 00 (default/idle); Elevator Moving = OFF; Multiple Requests = OFF
ICs allowed: AND, OR, NOT, NAND, XOR, XNOR
<div><br></div>
|