NJU3505
(2) PROGRAMMABLE INPUT/OUTPUT PORT OPERATION
a. The output operation example
PB0 and PB1 of PORTB output “H”, and PB2 and PB3 of PORTB output “L”.
:
SRPC
LDI Y,0
LDI A,%0001
TAP
LDI Y,2
LDI A,%0011
TAP
LDI Y,13
LDI A,%0010
TAP
:
;
; Peripheral table is
;
set as the table1
;
;PHY18 is pointed
;"0011" is stored into Accumulator
;Data in Accumulator is transmitted to PHY18
; (PORTB output register)
;PHY29 is pointed
;"0010" is stored into Accumulator
;Data in Accumulator is transmitted to PHY29
PORTB is
set as the output
b. The input operation example
Accumulator gets the input data from PORTB.
:
SRPC
;
LDI Y,0
LDI A,%0001
TAP
; Peripheral table is
;
set as the table1
;
LDI Y,13
LDI A,%0000
TAP
;PHY29 is pointed
;"0000" is stored into Accumulator
;Data in Accumulator is transferred to PHY29
PORTB is
set as the input
LDI Y,2
;PHY18 is pointed
TPA
;The input data from PHY18 is transferred to Accumulator
:
The signal from PB0 terminal is stored into the LSB of Accumulator, the signal from PB1 terminal is
stored into the b1 of Accumulator, the signal from PB2 terminal is stored into the b2 of Accumulator, and
the signal from PB3 terminal is stored into the b3 of Accumulator.
- 22 -