Download EENG 410 Microprocessors I Eastern Mediterranean University

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Flip-flop (electronics) wikipedia , lookup

Time-to-digital converter wikipedia , lookup

Two-port network wikipedia , lookup

Oscilloscope wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Tektronix analog oscilloscopes wikipedia , lookup

Opto-isolator wikipedia , lookup

Analog-to-digital converter wikipedia , lookup

Transcript
EENG 410 Microprocessors I
Eastern Mediterranean University
Faculty of Engineering
Department of Electrical and Electronic Engineering
(OPEN ENDED LABORATORY EXERCISE)
Objective: Learning how to access I/O ports in assembly language.
LAB Work: A. Write an assembly program that opens the LPT1 port and sends
predefined one byte binary number to the port.
Eight LEDs are connected to the other side of LPT1 cable, as shown in diagram 1.
LEDs state (ON/OFF) would be set according to equivalent binary value of the
output register.
Simple program to access LPT1 port ( Write -PC parallel port 1):
.MODEL SMALL
.STACK 64H
.CODE
MAIN: MOV AX,@DATA
MOV DS,AX
MOV AL,01010101B
MOV DX,0378H
OUT DX,AL
EXIT:
MOV AH, 4CH
INT 21H
END MAIN
Fig. 1
LAB Work: B. Write an assembly program that opens the LPT1 port and READ
one byte binary number from the port.
.MODEL SMALL
.STACK 64H
.CODE
MAIN: MOV AX,@DATA
MOV DS,AX
;--------Set Control Register to the read mode---------------------MOV DX,37AH
IN
AL,DX
OR
AL,00100000B
OUT
DX,AL
; SET BIT 5 ( READ MODE)
;--------Read one byte from data port ---------------------MOV DX,0378H
IN
AL, DX
EXIT:
END MAIN
MOV AH, 4CH
INT 21H
LAB FINAL PROJECT
Students can choose between HW 6.A and HW6.B.
HW6.A has 100% of lab final project grade.
HW6.B has 20% of lab final project grade.
In addition Each Group should submit the project report.
HW 6.A Make a Simple Digital Oscilloscope
In the first step, students have to design an 8 bits analog to digital convertor (A/D
or ADC) circuit. The designed ADC circuit`s input can be attached to a function
generator which generates an analog signal. The output of this circuit has to
connected to the Parallel port (LPT1) of the PC as an input (see Fig .2).
Fig. 2
In the second step, students have to write an assembly program that reads an 8 bits
digital number from the output of the ADC circuit as an input of program. This
procedure has to be done periodically and in predetermined time intervals
(sampling time). Then at each iteration the program has to graphically represent the
corresponding input number on two dimensional graph (2D) by allocating a dot/s
(point/s for each digital input sample) on the screen. Where the vertical axis
represents the amplitude of the input number (0-255) and horizontal axis represents
the sampling time.
**Students are responsible for implementing ADC circuited and parallel port
interface according to the following instruction.
Instruction:
Analog to Digital Converter
The easiest way to do analog to digital conversion is to use an IC such as the
ADC0804 that does the work for you. The analog voltage is applied to pin 6 and
the result is available at pins 11 through 18. We will connect pin 1 and 2 to ground
so that the chip is always enabled.
Connect pin 7 (Vin -) to the function generator`s ground. The ADC0804 includes
an internal oscillator which requires an external capacitor and resistor to operate.
Connect the 150 pF capacitor from pin 4 (CLOCK IN) to ground and the 10k ohm
resistor from pin 4 to pin 19 (CLOCK R).
Fig.3 Typical connection of free running mode
NOTES:
**In Fig.2 set the amplitude of the analog signal (generated by function generator)
between 0-5V. Frequency range of the analog signal should be chosen by student
depends on hardware and software sampling rate.
***In Fig.2 student may use the potentiometer instead of function generator to
generate an analog signal (Check your ADC datasheet).
Sampling Time (Interval)
The program has to sample the input signal at a fixed sample interval, ts. One of the
specifications for any digital oscilloscope is the sample rate, which is quite simply
equal to 1/ts. You can set the sample rate by timer and corresponding interrupts.
Note that the sample rate has also satisfies the Nyquist rate.
Fig .4
HW 6.B Make a Simple Digital Oscilloscope
The output of this circuit has to be connected to one data pin of the Parallel port
(LPT1) of the PC as an input (see Fig .5).
In the second step, students have to write an assembly program that reads 1 bit
from the parallel port. This procedure has to be done periodically and in
predetermined time intervals (sampling time). Then at each iteration the program
has to graphically represent the corresponding input bit (1 or 0) on two
dimensional graph (2D) by allocating a dot/s (point/s for each digital input sample)
on the screen. Where the vertical axis represents the amplitude of the input (0 or 5
volt) and horizontal axis represents the sampling time.
Fig. 5
NOTES:
Research Assistant
Ramin.Bakhshi
Office No. EE115
E-Mail: [email protected]