Docstoc

EE 485

Document Sample
EE 485 Powered By Docstoc
					EE 485

Makeup Test 2 Fall 2000

Honor Code: This test is administered under the School of Engineering Honor Code. "I pledge myself to uphold the highest standards of honesty in my university life and I will not tolerate dishonesty on the part of others."
You may submit two problems, one problem, or no problems. Problems submitted will be graded and the grade from the makeup test will be substituted for the grade for that problem on the original test 2.

Assume the following procedures are available to you in all programming problems:
Name Action I/0

CLS CRLF DISPDEC LIST$

Screen Display Subroutines Clears the screen and returns the cursor to the home (0,0) position. Sends a carriage return/line feed to the screen. The number in BX is displayed as a decimal number at the current cursor position. The ASCII string is displayed at the current cursor position.

Input: BX = a number Input: EDX = the address of a character string in memory, which must have a dollar sign ($) as the last character Input: AL = an ASCII character

PRNCHR

DECIBIN

The character is displayed on the screen at the current cursor position. Keyboard Entry Decimal digits are entered from the keyboard terminated by a carriage return Checks the status of the keyboard and returns immediately to the instruction following “Call getky” Does not return (but waits) until a key is pressed on the keyboard, which is echoed to the screen.. Termination Transfers to the operating system

GETKY

KEYWT

Output: BX = hexadecimal (or binary or octal) representation of the number If no key is currently being pressed, ZF =1. If a key is currently being pressed, ZF =0 and AL = ASCII of the key. Output: AL = ASCII of the key.

Go_OS

IO.EQU: You can assume that IO.EQU will be automatically included in your program. All 8255’s shown in this test can be assumed to be the externally available 8255 which can be accessed with the labels PORT2A, PORT2B, PORT2C, and STAT2. Good Housekeeping: A procedure will change only the register (or registers) used to convey results to the main program; all other registers will be unchanged on return.

Problem 2. (20 points) Write a commented 80x86 Linux procedure, Do8255 that will: Configure the 8255 with Port A in mode 0 input, Port B in mode 0 output, Port CH as an input, and Port CL as an output Wait until both PortA3 and PortA0 have a zero level Send a positive edge on PortB8 and set PortB7 to "1" without changing the value of any of the other pins of PortB Return Problem 3. (21 points) Shown below is the block diagram of an 8255 and of a "black box" counter. The black box operates as follows. When a negative edge is received on LD Count the 8 bits present at the Count input are latched into the counter, and the Count Complete line will go low. When the Count Enable line is low, the counter will decrement every time a negative edge is received on the Event line, and when the counter reaches 0 the Count Complete line will go high. Draw the connections between the 8255 and the black box and write a commented 80x86 Linux procedure, RatTimer, that will accomplish the following. When RatTimer is called, the number of edges to count is stored in the BL register. Return after the rat has pressed the lever the specified number of times and with BX containing the number of milliseconds it took the rat to press the lever. The rat press apparatus provides a negative edge every time the rat presses the lever. Assume you have a procedure ONEMS that provides a one millisecond delay every time it is called.

8255 D7-D0

PA7

PA0 PB7

Re se t
RD WR

PB0 PC7

CS
A1 A0 PC0

4. (21 points) Assume: that procedure GETAD is available that can read one of eight A/D converters and returns with an A/D reading in the AL register. The A/D channel that is to be read must be stored in AL before calling GETAD. On return, the A/D count is stored in AL and the resolution of the A/D is stored in AH. The resolution is given in millivolts per one-bit change of count. that you have the D/A converters of the 486 lab that can be accessed by labels DAC0, DAC1, …, DAC7. The D/A converters have been calibrated at 20 mv per one bit change. that the calling program has set the value of two variables in memory: Channel1 is a byte-wide variable that specifies one of the A/D channels to sample. Channel2 is a byte-wide variable that specifies the other A/D channel to sample Write a commented 80x86 Linux procedure, MAXV, that will continuously monitor the input voltages on the A/D channels indicated by Channel1 and Channel2 and output the following signal on D/A channel 5: Vout  0 volts if A / D1  A / D 2  1 volt
Vout  max(A/D1, A/D2) volts if A / D1  A / D 2  1 volt

DELTAVIN should terminate and return to the main program whenever any key is pressed on the keyboard.

5. (20 points) Shown below are the 80x86’s 32 address lines, IO / M , RD , and WR lines. Note that RD goes low when the 80x86 is doing a Read operation, and WR goes low when the 80x86 is doing a Write operation. Also shown is the block diagram of a the D/A converter in the 486 lab. The data sheet for the D/A converter is given on the following page. a) Draw a logic network and the connections between the 80x86’s lines and the logic network and the DAC that will place the DAC in the 80x86’s port address space at locations 0238 - 023F. b) What addresses will access the DAC if line AD15 of the 80x86 is shorted to ground?
AD31 AD30 AD29 AD28 AD27 AD26 AD25 AD24 AD23 AD22 AD21 AD20 AD19 AD18 AD17 AD16 AD15 AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0

IO/ M

RD
WR


				
DOCUMENT INFO