EXAMPLE
Using prototyping I/O Board through MTS -86C
Programmable Peripheral Interface (PPI)
The following example will guide you how to control the LEDs thr ough the I/O
board from MTS-86C PPI-1 interface.
1. Use provided flat cable to connect PPI -1 socket on MTS-86C and connect 8
LEDs to portB of PARALLEL BOARD, as shown in Figure 1.
Vcc
GND
GND
D0
Vcc
3
2
0
1
7
6
4
5
GND
C PORT C PORT
0
D1 B PORT
1
2
3
Vcc
PPI-2
D2
MTS-86C
CONNECT PORT
GND
BUS
D3
4
B PORT
5
6
PPI-1
7
Vcc
D4
GND
D5
PARALLEL I/O BOARD
0
A PORT
1
2
D6
3
Vcc
D7
GND
4
Figure 1
A PORT
5
6
A PORT A PORT
7
GND
Vcc
GND
Vcc
Vcc
7
0
6
1
2. Use following assembly code as the sample code to
control the LED. When the code is executed, the upper 4
and lower 4 LEDs will flash alternately, as shown in Figure 2.
Figure 2
CNT3 EQU 0FFFFH ; define 8255 control word register
BPORT3 EQU 0FFFBH ; define 8255 portB address
CODE SEGMENT
Explained in next slide
ASSUME CS:CODE, DS:CODE
ORG 0
START: MOV SP,4000H ; setup stack pointer
MOV AL,90H ; Setup 8255 control word register
MOV DX,CNT3 ; Enable 8255 control port
OUT DX,AL ; Output data 90h to 8255 control port
; 8255 mode0, portA=Input; portB,portC=Output
; < Output data 0F and F0 to LED repeatly >
MOV AL,0FH ; Initialize output data as 0Fh
MOV DX,BPORT3 ; Enable 8255 portB
J1: OUT DX,AL ; Output data 0Fh to LED
MOV CX,0A000H ; Setup CX register for time delay
LOOP $ ; Loop until CX register is equal to '0' (1)
NOT AL ; Reverse the signal in AL register (0F h F0h)
JMP J1 ; Jump to J1
CODE ENDS
END START
3. The most important part of
the program code is the V
V V
address definition of 8255
control word register and
portB. Since we use PPI-1 and
portB to control the LED, as
shown in Figure 1, we need to
use the relative address in the
program code. Table 1 lists
the port address of MTS-86C
system. It can be found that
Control word register and
portB of PPI-1 is addressed to
FFFFH and FFFBH
respectively.
Table 1: MTS-86C I/O port address
4. Compile the source code and download it to MTS -86C. You will be able to see the
LED flash alternately through I/O Board and PPI -1 interface.
Conclusion: to build your own circuit through PPI interface on M TS86C (PPI-1 or
PPI-2), the I/O port address in the program code need to be concerne d.
Note: The pin location of the PPI interface corresponding to the pin names in
parallel I/O board is shown below.