- Back to Home »
- CS401 Assignment no 3 Fall 2012 Full Solution
Posted by : Anonymous
Sunday, 6 January 2013
Question: 1
In this assignment, you have to deal with parallel ports as shown in Fig: 1.You have to read and write the parallel port’s data block using IN and OUT instructions.
We can control AC devices (switching them ON/OFF) by interfacing them with system’s Parallel Port as shown in Fig: 2.We have to use some external Electrical switching circuitry which needs some expertise to design it that will switch those devices ON or OFF depending upon the Parallel Port’s PIN status either Set (1) or Cleared (0).
Fig: 2
Suppose we have interfaced 5 different AC devices with our system’s parallel port and want those to be controlled using five different keyboard keys.
You have to write an assembly code that will read the device status (read the parallel port) and on the basis of that status, it will turn the specific device ON or OFF depending upon your input provided through keyboard as shown in Table: 1.
Keyboard Key | Data pin linked | Device Controlled or Action Performed |
F | Data Pin 0 | FAN Controlled |
L | Data Pin 1 | Light Controlled |
T | Data Pin 2 | Television Controlled |
D | Data Pin 3 | DVD player Controlled |
S | Data Pin 4 | Sound System Controlled |
Q | NIL | Program Exit/Quit/Terminate |
Table: 1
In your code, you have to read an input character (ASCII code only) from keyboard and then have to send a specific HEX value to parallel port to turn ON or OFF the specific device (depends upon the current state).
Note: If a device is ON, by pressing the assigned key the device should be set to OFF or vice versa. For example, if you have pressed “F” to switch ON the FAN then by pressing the key “F” again will switch OFF the FAN as shown in Table: 2.
You have to write a code in assembly language using ASCII standard that take an input character from keyboard (Capital letters:F, L, T, D, S and Q) and on the basis of these characters, you have to control attached AC devices via the parallel port.
Key Pressed | D0 | D1 | D2 | D3 | D4 |
F | 1 | ||||
L | 1 | ||||
T | 1 | ||||
D | 1 | ||||
S | 1 | ||||
Q |