Hey!
I have connected the HC12 via SPI to the EVAL-AD5781. Here is my program for this connection:
#include <stdio.h>
#include <mc912d128.h>
main()
{
DDRS = DDRS | 0xF0; /* outputs */
PORTS = PORTS | 0x80; /* Bring SS high */
SP0CR1 = 0x5A; /* 0b01011010 */
SP0CR2 = 0; /* Normal mode */
SP0BR = 0x00; /* 4 MHz SPI clock */
PORTS = PORTS & ~0x80; /* Bring SS low to select slave */
SP0DR = 0x200002;
while ((SP0SR & 0x80) == 0); /* wait for transfer to finish */
return SP0DR;
SP0DR = 0x1003FC;
while ((SP0SR & 0x80) == 0); /* wait for transfer to finish */
return SP0DR;
PORTS = PORTS | 0x80; /* Bring SS high to deselect slave */
}
The Program above belongs to the following document:
http://www.ee.nmt.edu/~rison/ee308_spr02/supp/020320.pdf
And for those of you, who are good in german! Here the link for the other forum, where I discuss the problem.
http://www.mikrocontroller.net/topic/215922#2167148
Questions? Please ask!
Thx!