Hardware Reference
In-Depth Information
The HCS12 assembler collects all the equate directives into an include file called hcs12.inc
so that the user can access any peripheral register by referring to an appropriate symbolic name.
In order to use symbolic names to access peripheral registers, the user should add the following
statement to his or her program, preferably as the first line of the program:
#include “c:\...\hcs12.inc” ; specify the directory that contains the hcs12.inc file
Although different assemblers may provide different include files, this author has prepared
an include file (hcs12.inc) in the complementary CD that enables the user to access peripheral
registers and their bits by referring to their names.
4.10.2 I/O Port Direction Configuration
Each I/O port has a data direction register (DDRx, x is the port name) that allows the user
to configure data transfer direction. Setting a bit in the DDRx register to 1 configures the asso-
ciated pin for output whereas setting a bit in DDRx to 0 configures the associated pin for input.
For example, the instruction
movb #$FF,DDRA ; configure Port A for output
confi gures Port A for output.
movb
#0,DDRA
; configure Port A for input
confi gures Port A for input.
The user can configure a few pins of an I/O port for input and the remaining pins for out-
put. For example, the instruction
movb #$55,DDRB
confi gures the even-numbered pins of Port B for output and the odd-numbered pins for input.
Port Name
No. of Pins
Pin Name
A
8
PA7 , PA0
B
8
PB7 , PB0
E
8
PE7 , PE0
H
8
PH7 , PH0
J
4
PJ7 , PJ0
K
7
PK4 , PK0
M
8
PM7 , PM0
P
8
PP7 , PP0
S
8
PS3 , PS0
T
8
PT7 , PT0
PAD1, PAD0
16
PAD15 , PAD0
L
8
PL7 , PL0
U
8
PU7 , PU0
V
8
PV7 , PV0
W
8
PW7 , PW0
Table 4.5 Number of pins available in each parallel port
 
Search WWH ::




Custom Search