EE 308 - LAB 8 Part 2

Final version for 2000

Test of Memory and Port Expansion

Now that you have completed your wiring, you will test your work.

Before adding chips to your daughterboard, check (and record) the resistance between VCC and GND. It should be at least several hundred ohms. If it is not this high, you have a mistake in your wiring.

Before adding chips to your daughterboard, connect the daughterboard to your HC12 board, and use a logic probe to check for power and ground. Connect your board to a 5 V supply. Make sure that the HC12 still works - i.e., make sure you get a DBug-12 prompt. With a logic probe, check for a logic high at every pin which is supposed to be wired to VCC, and for a logic low at every pin which is supposed to be wired to GND. This will insure that you did not wire your power supplies backwards; such backwards wiring could destroy all your ICs.

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.

$\overline{\tt {LSTRB}}$ A0 Type of Access
0 0 16-bit access of even address
Access data at even address 0xXXXX and
at odd address 0xXXXX+1
0 1 8-bit access of odd address 0xXXXX
1 0 8-bit access of even address 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 $\overline{\tt {LSTRB}}$ = 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.

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.

Turn off power, put in your Altera chip and the two memory chips, put the daughter board back on, and turn power on. Use a voltmeter to check your power supply voltage. If it is not 5 V, turn power off immediately - you have a problem in your wiring.

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
     LDS   #$0C00      ; Load DBug-12 stack pointer
     CLR   $0016       ; Disable COP 
     LDX   #$0A00      ; Clear out DBug12 RAM
     CLR   1,X+        
     CPX   #$0C00      
     BNE   $0D09       
     LDAA  #$2C        ; Enable LSTRB and R/W
     STAA  $000A       
     BSET  $000B,#$68  ; Expanded wide mode, turn on internal visibility
     BCLR  $0013,#$08  ; Put in one E-Clock stretch
     JMP   $F717       ; 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.

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.

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.

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.

Check to make sure that Port EA works for input.

If all of the above works, your board is wired correctly, and you now have 32 kbytes of RAM and two new ports. Congratulations!!!

Bill Rison, < >
Fri Mar 24 2000

© 2000, New Mexico Tech