用的是MPLAB 8.70 , 芯片PIC18F4550:
执行就是没结果,代码也很简单:
TRISCbits.RC7=0;
TRISBbits.RB1=0;
TRISAbits.RA5=1;
unsigned char sync_mode = SPI_FOSC_4;//MHz
unsigned char bus_mode = MODE_01; // default SPI bus mode 0,0
unsigned char smp_phase = SMPMID;
CloseSPI();
OpenSPI( sync_mode, bus_mode,smp_phase );
while(WriteSPI(0xaa));
CloseSPI();
while(1); |