4. Using the I/O Address Map
22
CNT16-8(FIT)GY,
CNT16-8L(FIT)GY
Bit Assignments for I/O Ports
The I/O ports for the counting function have command-section and data-section registers.
A register can be set as follows: First, a command is issued (OUT) to a port located at starting I/O
a 16 to make the register available for setting. For output, data is assigned (OUT) to the register
at port +17; for input, the +17 port is read. In other words, for both input and output, a command is
issued (OUT) to the output port +16 to make registers available for setting, and either data is issued
(OUT) to the port +17 to set the register or the register is read at the +17 port.
When setting a register even when using the same command, the command should be output to the
output port +16 each time.
Figures 4.8. and 4.9. show I/O port bit assignments.
Starting
I/O
address
D7 D6 D5 D4 D3 D2 D1 D0
+16
(10h)
Undetermined
Setting Data
+17
(11h)
Setting
Data 07
Setting
Data 06
Setting
Data 05
Setting
Data 04
Setting
Data 03
Setting
Data 02
Setting
Data 01
Setting
Data 00
Figure 4.8. Input Port
Starting
I/O
address
D7 D6 D5 D4 D3 D2 D1 D0
Command
+16
(10h)
Command
Data 07
Command
Data 06
Command
Data 05
Command
Data 04
Command
Data 03
Command
Data 02
Command
Data 01
Command
Data 00
Setting Data
+17
(11h)
Setting
Data 07
Setting
Data 06
Setting
Data 05
Setting
Data 04
Setting
Data 03
Setting
Data 02
Setting
Data 01
Setting
Data 00
Figure 4.9. Output Port
Flow of Count Values
[Command 00h - 07h]
Count
control
Count up
Carry
Interrupt mask
[Comand 11h]
Status data
[Command 12h]
[Command 14h]
Reading
count vaule
[Command 00h - 07h]
Count-vaule
latch
[Command 10h]
[FFFFh
→
0000h]
Initial count
setting
16-bit
UP/DOWN
counter
READ
register
Figure 4.10. Flow of Count Values