Datasheet
15-4 MCF5407 User’s Manual
Parallel Port Operation
15.1.4 Code Example
The following code example shows how to set up the parallel port. Here, PP[7:0] are
general-purpose I/O, PP[3:0] are inputs, and PP[7:4] are outputs.
MBARx EQU 0x00010000
PAR EQU MBARx+0x004
PADDR EQU MBARx+0x244
PADAT EQU MBARx+0x248
move.l #MBARx,D0 ;because MBAR is an internal register, MBARx is used as
movec D0, MBAR ;label for the memory map address
move.w #0x00FF,D0
move.w D0,PAR ;set up the PAR. PP[7:0] set up as I/O
move.w #0x00F0,D0
move.w D0,PADDR ;set PP[7:4] as outputs; PP[3:0] as inputs
move.b #0xA0,D0
move.b D0,PADAT ;0xA0 written into PADAT; PP[7:4] being outputs,
;PP[7:4] becomes 1010; i.e. PP7, PP5 = 1 and
;PP6, PP4 = 0
