本帖最后由 David_ming 于 2010-5-28 13:34 编辑
/*******************************
82G516 SPI TEST
*******************************/
#include "megawin.h"
#include "intrins.h"
void SPI(void)interrupt 8
{
SPISTAT = 0xc0;//clear flag
SPIDAT = 0x55;
}
void main(void)
{
EA = 1; //enable global interrupt
AUXIE |= 0x01; //enable SPI interrupt
SPICTL = 0x7b; //SS pin&open spi&low bit first&clk=1&...
SPISTAT = 0xC0;//clr flag
SPIDAT = 0x55; //start to send 0x55
while(1);
}
|