Figure 4.8 Connection Example For An Eight Segment Led; Program Example For I/O Ports - Fujitsu F2MC-8L MB89620 Series Hardware Manual

8-bit microcontroller
Table of Contents

Advertisement

8
4.

Program Example for I/O Ports

This section gives an example program using the I/O ports.
n Program Example for I/O Ports
l
Processing description
Ports 0 and 1 are used to illuminate all elements of a seven segment LED (eight segments if
the decimal point is included).
The P00 pin is used for the anode common pin of the LED and the P10 to P17 pins operate
as the segment pins.
As port 0 and port 1 are used, this example is for single-chip mode.
Figure 4.8 shows the connection example for an eight segment LED.
l
Coding example
PDR0
DDR0
PDR1
DDR1
M_MODE
M_MODE
;--------- Main program ------------------------------------------------------------------------------------------------------
;-------------------------------------------------------------------------------------------------------------------------------
116
CHAPTER 4 I/O PORTS
MB89620
P00
P17
P16
P10

Figure 4.8 Connection Example for an Eight Segment LED

EQU
0000H
EQU
0001H
EQU
0002H
EQU
0003H
DSEG
ABS
ORG
OFFFDH
DB
00H
ENDS
CSEG
:
CLRB
PDR0:0
MOV
PDR1,#11111111B
MOV
DDR0,#11111111B
MOV
DDR1,#11111111B
:
ENDS
END
.
.
.
.
.
.
.
.
; Address of the Port 0 data register
; Address of the Port 0 data direction register
; Address of the Port 1 data register
; Address of the Port 1 data direction register
; [DATA SEGMENT]
; Mode data (single-chip mode)
; [CODE SEGMENT]
; Set P00 to the "L" level.
; Set all port 1 pins to the "H" level.
; Set P00 as an output (#xxxxxxx1B).
; Set all port 1 pins as outputs.
MB89620 series

Advertisement

Table of Contents
loading

Table of Contents