7
4. 68HC12 Hardware:
This section explains the operation of the hardware on the 68HC12. It includes the
I/O ports, the A/D converter and the timer functions. Hardware interrupts are
explained in the next section. For more information on this material, refer to
Motorola document MC68HC812A4TS/D, "Motorola 68HC12 Technical Summary".
Ports:
All port names are of the format _H12PORTx, where x is the capital letter of the
port you are trying to access. i.e. Port A is _H12PORTA.
Ports A and B are used as the address bus for the 68HC12. They are not usable as
I/O by the programmer. Port A is the high order byte and port B is the low order
byte.
Ports C and D are used as the data bus for the 68HC12. They are not usable for I/O
by the programmer. Port C is the high order byte and port D is the low order byte.
Port E is used to generate control signals needed to access the external memory.
As a result the programmer can not use it for I/O. Port E pin 1 is used as the
input for the IRQ and Port E pin 0 is used as the input for the XIRQ.
Port F is used to control chip selects for the external memory and other chips. The
programmer can not use it as I/O.
Port G is a 6-bit general purpose I/O port. The direction of the port is controlled
by _H12DDRG. When an _H12DDRG bit is set to 0, the port pin is an input and when
it is set to 1 it is an output.
Port H is an 8-bit general purpose I/O port. The direction of the port is
controlled by the _H12DDRH. When _H12DDRH bit is set to 0, the port pin is an
input and when it is set to 1 it is an output.
Port J is an 8-bit general purpose I/O port. The direction of the port is
controlled by the _H12DDRJ. When _H12DDRJ bit is set to 0, the port pin is an
input and when it is set to 1 it is an output.
Port S is used for the SCI and the SPI. It can also be used for general I/O if the
SCI or SPI are not being used. Bits 0 and 1 are SCI0. These are used as the
interface to the terminal and can not be used as I/O. Bits 2 and 3 are SCI1 and
bits 4-7 are the SPI. These can be used as general I/O if SCI1 and the SPI are not
being used. The direction of the port is controlled by _H12DDRS.
Port T is used for the timer interrupts and the pulse accumulator. If the
interrupts are not being used then Port T can be used for general I/O. The port
direction is controlled by _H12DDRTT. Note: The two T's are not a typo.
Port AD is used exclusively as the input to the A to D converter. It can not be
used for any other I/O.
Ports G, H, and Port E pin 0 have optional pull-up resistors inside. These are
controlled by the _H12PUCR register. To enable the pull-up resistor for Port H
write a one to bit 7, for Port G write a one to bit 6, for Port E write a one to
bit 4 of _H12PUCR. To disable the pull-up resistors to a particular port, write a
0 to the appropriate bit.