Title: IO.equ
1IO.equ
- IO.equ has equate statements that give readable
names to the physical port addresses of
peripherals for 485/486 - IO.equ can be included in every assembly by
altering the Set a86 parameter - Set A86 mypath\IO.equ P64
- Because IO.equ contains only equate statements
which are evaluated at assembly time and do not
generate executable statements, its presence will
not affect the .com program
2 DAC0 0238h DAC 0 AD 7228 Port
0 DAC1 0239h DAC 1 AD 7228 Port
1 DAC2 023Ah DAC 2 AD 7228
Port 2 DAC3 023Bh DAC 3 AD
7228 Port 3 0 to 5 Volts Output DAC4
023Ch DAC 4 AD 7228 Port 4
DAC5 023Dh DAC 5 AD 7228 Port 5
DAC6 023Eh DAC 6 AD 7228 Port
6 DAC7 023Fh DAC 7 AD 7228
Port 7 WRTCH1 0220h Write Channel
Number A/D 0809 1 RDCHN1 0221h Read
A/D 0809 Data PORT1C 0222h Un-assigned
STAT1 0223h 8255-5 1A / Status Register
130D PORT2A 0224h Port A
externally available PORT2B 0225h Port B
externally available PORT2C 0226h Port C
externally available STAT2 0227h 8255-5
2A / Status Register STBAD1 0230h
Strobe A/D Latch Chan and Start
Conversion PCCT2 0042h PC, Counter
2 PCCTCW 0043h PC Counter control
word PCCHB 0061h PC's 8255 Channel B,
b0 controls T2 PCCHC 0062h PC's 8255
Channnel C,C5 mirrors T2
In the external aluminum chassis
Inside the PC
3Efficient, Readable Programming
- Set A86 c\a86\mark\mymacros.f98 P64
- will always assemble mymacros first so that they
are available to be used in the program and all
procedures - Set A86 c\a86\mark\mymacros.f98
c\a86\a86lib\io.equ P64 - will make your macros AND the names DAC0, WRTCH1,
STAT2, etc. available to be used in the program
and all procedures
4Homework for Thursday, Sept. 23
- Write your own benchmark program using Timer2
of the PC. That is, find the time it takes to
execute 100 instances of an instruction. Use
this program to compare execution speed of two
different computers. - Submit an electronic copy of your source file and
your .com file. Also submit an electronic text
file that reports execution times for 100
instances--state which instruction you
investigated, and the processor and speed of the
machines (if known).
5Flow chart for homework
Set up 8253
Start timer
Read timer
Mov Cx, 100L1 your instruction goes here Loop
L1
Read timer
Show elapsed time on screen(in units of 1.19 MHz
clock cycles)
6Time for 100 instructions
Note 4400/100/1.19106 3.710-5 37
mS 16633/100/1.19106 1.410-4 140 mS
78255 PPI(Programmable Peripheral
Interface)(Parallel Port Interface)
8
Data
Port A
Port B
RESET
CH
Port C
CL
A1
A0
88255 Control Register (Status Word)
The 8255 Control Register is a Write-Only
register.
9Setting up and using an 8255
- Step 1 Mov Dx, Stat2
- Mov al, controlword
- Out dx, al set up ports A, B, C
- as inputs or outputs
- Step 2
- Mov Dx, Portx
- In al, dx to read a port
- or
- Out dx, al to write to a port
10Levels vs. Edges
- Some devices are level-sensitive (such as the
8253 in modes 0, 2, 3, and 4. - Setting or detecting a level is a straightforward
In or Out instruction - Digital devices often use edges to trigger
actions or to send signals - Speed differences between two devices can be
overcome - The sending device does not have to hold a
particular level
11Edges
- To detect a positive edge
- 1) Wait for a low level
- 2) Wait for a high level
- To detect a negative edge
- 1) Wait for a high level
- 2) Wait for a low level
12Getky vs. Keywt
Getky can be used to give a human a way to
terminate an endless loop
13Time Scales
- The computers in 485/486 run at 10 MHzAn
instruction typically takes about 5 clock
cycles about 0.5 mS/instruction - Quick typists type at 100 wpmA word is about 8
characters800 char/min is approximately
80,000 mS/char - 160,000 machine instructions/typed character
Dont check the keyboard too often!
14Homework for Thursday, September 30
- Assume there are two digital devices. Device A
generates a positive edge when it detects an
anomaly, and Device B generates a negative edge
when it detects an anomaly. - Write a commented 8088 assembly language
procedure, WatchAB that will configure the 8255
of 486 lab so that Ports A and CH are inputs and
Port B and CL are outputs. - If Device A detects the first anomaly, then
send negative edge on bit C3 and call procedure
Afirst. If device B detects the first anomaly,
then set bit C0 high and call procedure Bfirst.
Return after handling the first anomaly. - Your procedure should change only the bits it
needs to change. Your procedure should obey the
good housekeeping rules
15Diagram of Experiment
Port A
8
Data
Port B
RESET
Data In
CH
A1
CL
A0