ELEC4601 Microprocessors Lab 2 Tutorial
Download
Report
Transcript ELEC4601 Microprocessors Lab 2 Tutorial
ELEC4601 Microprocessors
Lab 2 Tutorial
Signal Waveforms and
Parallel port programming
Reading Materials
• From your class notes:
– Pin-outs and Pin Functions (pages 66-70)
– Bus Buffering and Latching (page 72)
– Bus Timing (pages 75 - 79)
• From the SDK-86 manual:
– OB (Output Byte) Command (page 3-15)
• From the Peripherals Handbook:
– 8255A (starting on page 3-100, specifically page 3104)
• From the 8086 Hardware Reference Manual:
– Look up commands OUT, MOV and JMP (For # of
clock cycles, numbers in brackets are for 186)
Pre-lab
• For your Pre-Lab:
– Calculate the number of clock cycles
expected in the program fragment of part A
(page Lab#2-4)
– Find Control Byte value (part B step 1)
– Write the program (part B step 4)
• Further study (from Lab Manual):
– Read Appendix A, logic analyzer operation
– Read Appendix B, in particular the 8255A and
DAC extensions
Part A
SIGNAL WAVEFORMS
Objectives
• Understand bus cycles / timing
• What do the ALE, WR and RD bits indicate?
• Can you tell what is the happening during
each clock cycle by looking at ALE, WR, RD
and contents of the bus?
• Instruction pre-fetching, and the effect of JMP
on the instruction queue
Pre-lab
Calculate the number of cycles the program
segment should take to execute (page Lab#2-4)
Lab2.asm available on the course web
Procedure
1. Run the program (lab2.asm)
– Infinite loop that continuously moves data from register to memory
2. Monitor bus signals during program execution
– Logic Analyzer will show the signals (20 bit address/data, WR, RD,
ALE, PCLK)
– Show the Analyzer waveform to a TA to verify
3. Draw the waveforms on the timing diagram in lab manual
(Show your work. Rest of part A can be done after the lab)
4. Interpret what is happening at each clock cycle (Table 1)
5. Explain what is happening on the bus during program
execution (Q. 5-8)
Logic analyzer view (incorrect!)
Part B
PARALLEL PORT
PROGRAMMING
Objectives
• Understand how to set up 8255A I/O port
• Understand how to output values to the port
• Understand how to determine control word to
configure the port
• Understand how the D/A converter works
• Write a program using this information to produce
a sawtooth waveform
– You should be able to adjust the period and amplitude
of your waveform by adjusting your code
DA converter concept
D/A converter produces converts digital
value to analogue
•
Each data byte you output to D/A
converter will produce a certain
constant voltage level
•
Your code will have to make the output
a continuous (?) sawtooth waveform
Voltage levels linearly related to data
values (which range from 00H to FFH)
o/p
voltage
0V
Demonstrate your waveform to TA
1. Ramp from your pre-lab code
2. Modification you made later
7F
Part B: Pre-Lab
Determine the control word needed for
part B
Write the program for Part B (name it
lab2b.asm)
Try to optimize your coding
Know how you can adjust the amplitude
and period
Modify program
Part B: Procedure
• Program the I/O port for certain output
– 8255A: I/O component is used to interface to CPU
– Control register is used to configure ports
– Use OB (output byte) command from keypad to output to ports
– Use OUT command in your program to do the same
• Use this port to send data values to the D/A converter
• Find data values that produce specified voltage levels
– You will use an oscilloscope to view the D/A output
– Your should be able to calculate certain data value needed for
certain output voltage
See you next week!