
218
CHAPTER 8 I/O PORTS
MB90560 series
8.10 Sample I/O Port Program
This section provides a sample program using I/O port pins.
I
Sample I/O Port Program
G
Processing specifications
Ports 0 and 1 are used to turn on all segments of a seven-segment (eight-segment if the
decimal point is included) LED.
Pin P00 corresponds to the anode common pin of the LED, and pins P10 to P17 correspond
to the segment pins.
Figure 8.10-1 is an example of connecting the eight-segment LED to the MB90560 ports.
Figure 8.10-1 Example of eight-segment LED connection
G
Coding example
PDR0
PDR1
DDR0
DDR1
;-----------------------------Main program------------------------------------------------------------------------------------------------
--------------
CODE
CSEG
START:
; Initialization
MOV
I:PDR0, #00000000B ; Puts P00 at a low level (#xxxxxxx0B).
MOV
I:DDR0, #11111111B ; Puts all port 0 bits in output mode.
MOV
I:PDR1, #11111111B ; Sets all port 1 bits to 1.
MOV
I:DDR1, #11111111B ; Puts all port 1 bits in output mode.
CODE
ENDS
; -------------------------------------------------------------------------------------------------------------------------------------------------
--------------
END
START
EQU
EQU
EQU
EQU
000000H
000001H
000010H
000011H
MB90560
P00
P17
P16
P15
P14
P13
P12
P11
P10