PIC16F877A SPI SLAVE 模式没办法发送数据? PROTEUS 仿真得不到...
PIC16F877A SPISLAVE 模式没办法发送数据? PROTEUS 仿真得不到结果,DX帮忙看看~~~#include<pic.h>
__CONFIG(0X3F3B);
unsigned char temp=0,temp_char=50;
void Initial();
void PORTs_Initial();
void Spi_Initial();
void main()
{
Initial();
while(1)
{};
}
void Initial()
{
PORTs_Initial();
Spi_Initial();
GIE=1;
PEIE=1;
SSPIE=1;
}
void PORTs_Initial()
{
ADCON1=0X07;
TRISA5=1;
RA5=1;
TRISC3=1;
TRISC4=1;
TRISC5=0;
RC5=1;
TRISB=0X00;
RBPU=0;
}
void Spi_Initial()
{
SSPSTAT=0B00000000; //SMP=0;CKE=0;
SSPCON =0B00110101; //SSPEN=1;CKP=1; SSPM3:SSPM0=0101;
}
void interrupt ISQ()
{
if(SSPIE&&SSPIF)
{
temp_char=SSPBUF;
PORTB=temp;
SSPIF=0;
BF=0;
GIE=0;
SSPIE=0;
SSPBUF=0xDD;
while(~SSPIF);SSPIF=0;
SSPIE=1;
GIE=1;
};
}
页:
[1]