GENERAL-PURPOSE I/O (PORT C)
MOTOROLA
PORT C
6 - 7
I/O processing.
The DSP does not have a hardware data strobe to strobe data out of the GPIO port. If a data
strobe is needed, it can be implemented using software to toggle one of the GPIO pins.
Figure 6-7 shows the process of programming Port C as general-purpose I/O. Normal-
ly, it is not good programming practice to activate a peripheral before programming it.
However, reset activates the Port C general-purpose I/O as all inputs, and the alter-
native is to configure the port as an SCI and/or SSI, which may not be desirable. In
this case, it is probably better to insure that Port C is initially configured for gener-
al-purpose I/O and then configure the data direction and data registers. It may be bet-
ter in some situations to program the data direction or the data registers first to prevent
two devices from driving one signal. The order of steps 1, 2, and 3 in Figure 6-7 is
optional and can be changed as needed.
6.2.2
Port C General Purpose I/O Timing
Parallel data written to Port C is delayed by one instruction cycle. For example, the follow-
ing instruction:
MOVE
DATA9,X:PORTC
DATA24,Y:EXTERN
1. writes nine bits of data to the Port C register, but the output pins do not change
until the following instruction cycle
2. writes 24 bits of data to the external Y memory, which appears on Port A dur-
ing T2 and T3 of the current instruction
As a result, if it is necessary to synchronize the Port A and Port C outputs, two instructions
must be used:
MOVE
DATA9,X:PORTC
NOP
DATA24,Y:EXTERN
:
:
MOVEP #$0,X:$FFE1
;Select Port C to be general-purpose I/O
MOVEP #$01F0,X:$FFE3
;Select pins PC0–PC3 to be inputs
:
;and pins PC4–PC8 to be outputs
:
MOVEP #data_out,X:$FFE5
;Put bits 4–8 of “data_out” on pins
;PB4–PB8 bits 0–3 are ignored.
MOVEP X:$FFE0,#data_in
;Put PB0–PB3 in bits 0–3 of “data_in”
Figure 6-6 Write/Read Parallel Data with Port C
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
.
..