<aside> <img src="/icons/map-pin_gray.svg" alt="/icons/map-pin_gray.svg" width="40px" /> The order of each section are listed in the order presented in lectures, so certain sections are covered earlier.

</aside>

4.10 Introduction to Parallel I/O Port and Simple I/O Devices

So what exactly are I/O ports? If you notice during your labs, the microcontroller was connected to a few devices, like:

The I/O ports are used to connect these input and output devices to the microcontroller.

I/O Port Direction Configuration

An HCS12 device may have from 48 to 144 signal pins arranged in 3 to 12 I/O ports, shown below.

Figure 4.1 Number of pins available in each parallel port.

Figure 4.1 Number of pins available in each parallel port.

Each I/O port has a set of pins and each port has two main registers:

  1. Port Direction Register (DDR): The following configures the ports as input or output.
  1. Port Data Register (PORT): The following is where data is exchanged with peripheral.

Addressing the I/O Port Register

If you remember in figure 1.2 of the memory map, the registers are stored from $0000 to $03FF. The addresses of the data registers and data direction registers are defined in mcmc9s12dg128.inc, which refers to following addresses.

Figure 4.2 Register Address for ports.

Figure 4.2 Register Address for ports.

I’ll expand more on this in the following page below, if you’re interested: