
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Sample Problem Interfacing with I/O and Peripherals (10 points) (a) Consider the figure P4c for interfacing with four input devices at four input ports and their status at the corresponding bits on the 5th input port. These input ports are named as Dev0, Dev1, Dev2, Dev3, Status. The addresses of these ports in the input address space are as follows:
Port Name Dev_0 Dev_1 Dev_2 Dev_3 Status Address 01h 02h 04h 08h 10h
Where the status register is given by Bit 0 1 2 3 4 5 6 7 Puropose Dev_0 Dev_1 Dev_2 Dev_3 X X X X
Fig P4c. Flowchart of Round Robin Priority
Write a sequence of instructions that reads the inputs from the four input devices into AL register in a round robin priority manner. A flow chart for implementing round robin priority is given in Figure P4c. You need not worry about saving AL register.
i = 0
Read Status
If Dev i status SET
Read Device i
i = (i+1) mod 4
No Yes