
ECE 331 Spring 2009 Homework 9 -solution
Due Friday April 10 at the beginning of class.
1. List the two I/O Addressing approaches discussed in class. Briefly (one sentence) describe
the difference between them.
1) Memory mapped, 2) Isolated. Memory mapped shares address space
between memory and I/O devices while Isolated splits the memory into two
sets of addresses selected by a M/IO’ signal.
2. Briefly describe the general function of Microcontroller (MCU) Registers.
Memory locations that store MCU configuration data or provide interfaces
to on-chip I/O devices.
3. Briefly describe what an I/O Port is on a microcontroller.
Set (generally 8) of signals connected to MCU pins that can be read/written
by software through a data register. Ports can be input, output, or bi-
directional.
4. How would you set a bi-directional I/O port to be an output port?
Port direction is controlled by values stored in a Data Direction Register.
For the HC12, storing a ‘1’ in the DDR sets the port to output.
5. Write a program segment that would set the lowest two pins (1:0) of Port K to be outputs and
the upper six pins (7:2) to be inputs. Use the MCU Register addresses for an HCS12 device.
LDAA #$03
STAA $F0
6. Using the block diagram for the MC9S12DP256, list the secondary functions (other than
general purpose I/O) of each of the following ports on the HCS12.
a) Port A expanded mode address/data port, upper byte
b) Port B expanded mode address/data port, lower byte
c) Port H interrupt functions
a) Port P SPI comm. port (2) or pulse width modulator
d) Port S comm. port: SPI and SCI (2)
e) Port T timer
f) Port AD0 analog to digital converter, channel 0
g) Port AD1 analog to digital converter, channel 1
h) Port E expanded mode control port, interrupts, mode select