9.10
Sample I/O Port Program
This section provides a sample program using I/O port pins.
■ Sample I/O Port Program
●
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 9.10-1 is an example of connecting the eight-segment LED to the MB90460/465 series ports.
MB90460/465 series
●
Coding example
PDR
PDR1
DDR0
DDR1
;-----------------------------Main program----------------------------------------------------------------------------------
CODE
START:
CODE
;--------------------------------------------------------------------------------------------------------------------------------
Figure 9.10-1 Example of Eight-segment LED Connection
P00
P17
P16
P15
P14
P13
P12
P11
P10
EQU
000000H
EQU
000001H
EQU
000010H
EQU
000011H
CSEG
MOV
I :PDR0, #00000000B
MOV
I:DDR0, #11111111B
MOV
I:PDR1, #11111111B
MOV
I:DDR1, #11111111B
ENDS
END
START
CHAPTER 9 I/O PORT
; Initialization
; Puts P00 at a low level (#XXXXXXX0B)
; Puts all port 0 bits in output mode
; Sets all port 1 bits to "1"
; Puts all port 1 bits in output mode
203