Colegio de San Juan de Letran Calamba: School of Engineering MICRO131L: Microprocessor Systems Assignment No. 2
Colegio de San Juan de Letran Calamba: School of Engineering MICRO131L: Microprocessor Systems Assignment No. 2
School of Engineering
Assignment No. 2
Grade
Group Number : 4
DE CLARO, Ellaine P.
JOVIDA, Rommel Jr. G.
LAGUA, Myles C.
This MPU-based system consists of two inputs (start and stop) and three outputs (conveyor
motor 1, counter indicator, and conveyor motor 2). Conveyor motor 1 turns ON while bottle counter
is not equal to 6 else conveyor motor 2 turn ON and conveyor motor 1 turn OFF for five seconds and
counter will reset to zero. Counter indicator indicates the counting by turning ON and OFF the lights
with an interval of 1 second. Start input is use to turn ON the system while stop input is use to
terminate all the process
INPUT (PORT C) OUTPUTS (PORTB)
SWITCH STAT PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 HEX
TSW (PC0)
LED1 LED2 FWD1 REV1 STP1 FWD2 REV2 STP2
SYSTEM STOP 00h 0 0 0 0 1 0 0 1 09h
SYSTEM START
CONV1 ON (LED on) 01h 1 1 1 0 0 0 0 1 E1h
CONV1 ON (LED off) 01h 0 0 1 0 0 0 0 1 21h
CONV2 ON (LED on) 01h 1 1 0 0 1 1 0 0 CCh
CMD_REG_VAL
MODE PA PCU MODE PB PCL
1
0 0 0 0 0 0 1
INPUT: PORTC
OUTPUT: PORTB
.MODEL
.STACK 64
.DATA
count DB 0
.CODE
ORG 100h
CALL clear_reg
JMP init_port
CONVEYOR_ON:
C1: CMP count,6
JNE convy1_1
C2: JMP convy2
END init_port
APPLICATION 2 – Comfort Room Monitoring
Design an MPU-based Comfort Room Monitoring. This system will monitor the number of
person entering and leaving. The total capacity of Comfort Room can accommodate up to 5
persons. The system will provide an automatic door-lock if the comport room is loaded. The
entrance door is only open if the number of persons entering is less than the maximum capacity of
the Comfort Room. Other features of this system will also provide an automatic flushing for those
terminal/s used. Inputs are five sensors for each terminal, 0-5 up/down counter, and for the outputs
use 6 solenoid valves: one for door-lock and five for the terminals flushing. Assume that the
entrance door is unidirectional door.
Answer:
.CODE
org 100h
CALL clear_reg
JMP init_port
init_port:
MOV DX, CMD_REG ;initializing first the
control registers
MOV AL, CMD_BYTE
OUT DX, AL
JMP check_sensor
check_sensor:
mov ah, counter
cmp ah, 05h
JE doorlock
MOV DX, PORTC ; initialize the PORTC ( INPUT
PORT)
IN AL, DX
CMP AL,SENSOR1_ON
JE increment_1
increment_1:
inc counter
jmp SENSOR1_ACTIVATE
increment_2:
inc counter
jmp SENSOR2_ACTIVATE
increment_3:
inc counter
jmp SENSOR3_ACTIVATE
increment_4:
inc counter
jmp SENSOR4_ACTIVATE
increment_5:
inc counter
jmp SENSOR5_ACTIVATE
SENSOR1_ACTIVATE:
MOV DX, PORTA
MOV AL, SENSOR_OFF
OUT DX,AL
MOV DX, PORTC
IN AL, DX
CMP AL, SENSOR_OFF
JNE SENSOR1_ACTIVATE
MOV DX, PORTA
MOV AL, SENSOR_ON
OUT DX,AL
CALL DELAY_5SEC
dec counter
JMP check_sensor
SENSOR2_ACTIVATE:
MOV DX, PORTA
MOV AL, SENSOR_OFF
OUT DX,AL
MOV DX, PORTC
IN AL, DX
CMP AL, SENSOR_OFF
JNE SENSOR2_ACTIVATE