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

Colegio de San Juan de Letran Calamba: School of Engineering MICRO131L: Microprocessor Systems Assignment No. 2

This microprocessor-based system summarizes a comfort room monitoring system that tracks the number of people entering and leaving a comfort room. The system uses inputs from 5 sensors (one for each terminal) and outputs to control a door lock solenoid and 5 terminal flushing solenoids. The system monitors the count to ensure it does not exceed the maximum capacity of 5 people, locking the door if reached. It increments the count on sensor activation and decrements on deactivation, activating the corresponding flushing solenoid for 5 seconds after each decrement.

Uploaded by

ELLAINE DE CLARO
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Colegio de San Juan de Letran Calamba: School of Engineering MICRO131L: Microprocessor Systems Assignment No. 2

This microprocessor-based system summarizes a comfort room monitoring system that tracks the number of people entering and leaving a comfort room. The system uses inputs from 5 sensors (one for each terminal) and outputs to control a door lock solenoid and 5 terminal flushing solenoids. The system monitors the count to ensure it does not exceed the maximum capacity of 5 people, locking the door if reached. It increments the count on sensor activation and decrements on deactivation, activating the corresponding flushing solenoid for 5 seconds after each decrement.

Uploaded by

ELLAINE DE CLARO
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Colegio de San Juan de Letran Calamba

Bo. Bucal Calamaba City, Laguna

School of Engineering

MICRO131L: Microprocessor Systems

Assignment No. 2

Grade

Group Number : 4

DE CLARO, Ellaine P.
JOVIDA, Rommel Jr. G.
LAGUA, Myles C.

Date Submitted: 10/15/19

Engr. Ricrey E. Marquez, CpE, MSCS


(Instructor)
BOTTLE CONVEYOR SYSTEM

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

PORTA EQU 0300h


PORTB EQU 0301h
PORTC EQU 0302h
CMD_REG EQU 0303h
CMD_BYTE EQU 81h

STOP EQU 00h


START EQU 01h
CONV1_LED_ON E1h
CONV1_LED_OFF 22h
CONV2_LED_ON CCh
CONV2_LED_OFF 0Ch
CONV_ALL_STOP 09h

.CODE

ORG 100h
CALL clear_reg
JMP init_port

init port: MOV DX, CMD_REG


MOV AL, CMD_BYTE
OUT DX, AL
JMP check_switch
check_switch: MOV DX, PORTC
IN AL, DX
CMP AL, START
JE CONVEYOR_ON
CMP AL, STOP
JE CONVEYOR_OFF
JMP check_switch

CONVEYOR_ON:
C1: CMP count,6
JNE convy1_1
C2: JMP convy2

CONVEYOR_OFF: MOV DX, PORTB


MOV AL, CONV_ALL_STOP
OUT DX, AL
JMP check_switch

1sec PROC NEAR


MOV CX, 7FFFh
DEL1: NOP
NOP
NOP
NOP
LOOP DEL1
RET
1sec ENDP

check_terminate PROC NEAR


MOV DX, PORTC
IN AL, DX
CMP AL, STOP
JE CONVEYOR_OFF
RET
check_terminate ENDP

clear_reg PROC NEAR


XOR AX, AX
XOR BX, BX
XOR CX, CX
XOR DX, DX
RET
clear_reg ENDP
convy1_1: MOV DX, PORTB
MOV AL, CONV1_LED_ON
OUT DX, AL
CALL 1sec
CALL check_terminate
INC count
CMP count,6
JNE convy1_2
JMP C2

convy1_2: MOV DX, PORTB


MOV AL, CONV1_LED_OFF
OUT DX, AL
CALL 1sec
CALL check_terminate
INC count
CMP count,6
JNE convy1_2
JMP C2

convy2_1: MOV DX, PORTB


MOV AL, CONV2_LED_ON
OUT DX, AL
CALL 1sec
CALL check_terminate
INC count
CMP count, 11h
JNE convy2_2
MOV count, 0
JMP check_switch

convy2_2: MOV DX, PORTB


MOV AL, CONV2_LED_OFF
OUT DX, AL
CALL 1sec
CALL check_terminate
INC count
CMP count, 11h
JNE convy2_1
MOV count, 0
JMP check_switch

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:

Note: Port A – Output, Port C – Input therefore, Command byte = 89h


.MODEL small
. STACK 64
. DATA

counter db 0 ; counter for checking the max


people inside the room
i db 0

PORTA EQU 0300h ; Equating PORTA to address


0300
PORTC EQU 0302h ; Equating PORTC to address
0302

CMD_REG EQU 0303h ; control register to address


0303h
CMD_BYTE EQU 89h ; PPI control register where PORTA
is output and PORTC
; is input

SENSOR1_ON EQU 01h


SENSOR2_ON EQU 02h
SENSOR3_ON EQU 04h
SENSOR4_ON EQU 08h
SENSOR5_ON EQU 10h
SENSOR_OFF EQU 00h
DOORLOCK_ON EQU 20h
DOORLOCK_OFF EQU 00h

.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

CMP AL, SENSOR2_ON


JE increment_2
CMP AL, SENSOR3_ON
JE increment_3
CMP AL, SENSOR4_ON
JE increment_4
CMP AL, SENSOR5_ON
JE increment_5
JMP check_sensor
doorlock:
MOV DX, PORTA
MOV AL, DOORLOCK_ON
OUT DX,AL
MOV DX, PORTC
IN AL, DX
CMP AL, DOORLOCK_OFF
JNE check_sensor
MOV DX, PORTA
MOV AL, DOORLOCK_OFF
OUT DX,AL
CALL DELAY_5SEC
JMP check_sensor

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

MOV DX, PORTA


MOV AL, SENSOR_ON
OUT DX,AL
CALL DELAY_5SEC
dec counter
JMP check_sensor
SENSOR3_ACTIVATE:
MOV DX, PORTA
MOV AL, SENSOR_OFF
OUT DX,AL
MOV DX, PORTC ; initialize the PORTC ( INPUT
PORT) CHECK IF THE SENSOR IS OFF
IN AL, DX
CMP AL, SENSOR_OFF
JNE SENSOR3_ACTIVATE
MOV DX, PORTA
MOV AL, SENSOR_ON
OUT DX,AL
CALL DELAY_5SEC
dec counter
JMP check_sensor
SENSOR4_ACTIVATE:
MOV DX, PORTA
MOV AL, SENSOR_OFF
OUT DX,AL
MOV DX, PORTC
IN AL, DX
CMP AL, SENSOR_OFF
JNE SENSOR4_ACTIVATE
MOV DX, PORTA
MOV AL, SENSOR_ON
OUT DX,AL
CALL DELAY_5SEC
dec counter
JMP check_sensor
SENSOR5_ACTIVATE:
MOV DX, PORTA
MOV AL, SENSOR_OFF
OUT DX,AL
MOV DX, PORTC
IN AL, DX
CMP AL, SENSOR_OFF
JNE SENSOR5_ACTIVATE
MOV DX, PORTA
MOV AL, SENSOR_ON
OUT DX,AL
CALL DELAY_5SEC
dec counter
JMP check_sensor
; PROCEDURE DECLARATION
clear_reg PROC NEAR
XOR AX,AX
XOR BX,BX
XOR CX,CX
XOR DX,DX
RET
clear_reg ENDP

DELAY_1SEC PROC NEAR


MOV CX, 7FFFh ;approx. 1 sec
del:
NOP
NOP
loop del
RET
DELAY_1SEC ENDP

DELAY_5SEC PROC NEAR


MOV i, 0
del5:
CALL DELAY_1SEC
inc i
cmp i, 5
jne del5
RET
DELAY_5SEC ENDP
END init_port

You might also like