Serial Communications using the HC12 SPI and the MAX522 D/A Converter
For the prelab, write the program for Part 4 of this lab.
In this lab you will will use the HC12 SPI serial interface to communicate with a serial D/A converter. You will use the on-board A/D converter to read a voltage from a potentiometer, and reproduce that voltage with the D/A converter.
When wire-wrapping, strip about 1" of insulation off the wire-wrap wire. (There is a wire stripper inside the wire wrap tool.) Put this into the smaller hole at the tip of the wire wrap tool. Put the bigger, central hole of the wire wrap tool over the pin you are wiring to. Turn the wire wrap tool -- either way will work; normally, a wire-wrap tool is turned clockwise to put a wire on. Be consistent -- if you make a mistake and need to remove a wire, you turn the tool the other way. Cut the wire so it is long enough to reach the other pin (with enough left over to strip 1" of insulation), but not much longer. Strip off 1" of insulation, and wrap onto the other pin.
Here is the way I did it. Note that you should use green wire from ground pins, and red wire for power pins. The other colors are suggestions only; use any color (other than green and red) you like.
Note that when you try to write to SPODR, DBug12 will tell you it couldn't do it -- that this address must be ROM. The reason for this is simple. Say you write an 0x22 to SP0DR. DBug12 writes an 0x22 to the register, then reads back to see if that value is there. When DBug12 reads SP0DR, it reads what was shifted in from the slave. Since nothing is connected to MISO, DBug12 will read an 0x00. This is not the same as what was written, so DBug12 thinks something is wrong. However, nothing went wrong, and the 0x22 was written to the MAX522 (if your wiring is correct).