EE 308 - LAB 9 Final version for 2001
Setup for Additional Memory, Ports, and D/A Converter
Final version for 2001
In this lab you will add memory and ports to your HC12.
1.
Program your Altera chip to act as the address demultiplexer and
decoder, and to supply your two new eight-bit I/O ports. To program
your Altera chip use the results from
Homework 9.
One important consideration in completing Homework 9 is
understanding when the HC12 will access even addresses and when it will
access odd addresses. The following table (modified from Table 13
of the MC68HC912B32 Technical Summary) may help you.
|
A0 |
Type of Access |
0 |
0 |
16-bit access of even (upper) byte
Access data at even address 0xXXXX and
at odd address 0xXXXX+1 |
0 |
1 |
8-bit access of odd (lower) byte 0xXXXX |
1 |
0 |
8-bit access of even (upper) byte 0xXXXX |
1 |
1 |
16-bit access of odd address
Not used for external addressing |
Note that if A0 = 0, the HC12 will access the even memory location at
0xXXXX. If
= 0, the HC12 will
access an odd memory location. When accessing odd addresses, if address
0xXXXX is even, the HC12 accesses odd address 0xXXXX+1
as well as the even address 0xXXXX; if address 0xXXXX
is odd, the HC12 accesses only the odd address 0xXXXX.
2.
To program the Altera chip on the memory expansion board, you need to make
sure you have the correct pinout, and select the correct chip. Be sure to
select an EPM7128ATC-12 chip. The file hc12_exp.acf
will give you the information you need to assign the pins.
Connect the cable you made between the parallel port of your computer and the
Altera chip of the exapnsion board. Program the Altera chip.
When programming the Altera chip it is important to make sure the pins
assigned by the Altera compiler match your wiring. You need to do this as
part of Homework 9.
3.
Go into DBug-12
and type in the following program at address 0x0D00. Do not type in the
comments preceded by a semicolon after the instructions; these are for your
information only.
>asm 0D00
LDAA #$2C ; Enable LSTRB and R/W
STAA $000A
BSET $000B,#$68 ; Expanded wide mode, turn on internal visibility
BCLR $0013,#$0C ; Put in zero E-Clock stretches
JMP $F700 ; Jump to DBug-12
Move Jumper W3 to Position 1, and Jumper W4 to Position 0, then
push the reset button on your HC12.
Your HC12 will execute the above code, which will put it into expanded wide
mode.
4.
Fill all of the expanded memory with 0xAAs, then with 0x55s.
(Use the BF command of DBug-12.) If this works, then your memory is
probably wired correctly.
5.
Connect wires from Expanded Port A (from now on called Port EA) to
the LEDs on your breadboard. Set up Port EA for output by setting bit 0
of address 0x402. To do this, do the following in DBug-12: Change
the value of address 0x0402 to 0x01, Then use Port EA to turn
on and off the LEDs on the breadboard. Do this in DBug-12 by changing the
value of address 0x0400.
6.
Check out your expanded Port B (Port EB) in the same way. To make
Port EB an output, set bit 4 of address 0x0402. You should
be able to use Port EB to turn on and off LEDs by writing to
address 0x0401.
7.
Check to make sure that Port EA works for input.
8.
If all of the above works, your board is wired correctly, and you
now have 32 kbytes of RAM and two new ports.
Bill Rison
2001-03-24