#include
static volatile int table[20]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xd8,0x80,
0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0x7f,0xbf,0x89,0xff};
volatile unsigned char data;
#define PORTAIT(adr,bit) ((unsigned)(&adr)*8+(bit))
static bit LOCK @ PORTAIT(PORTA,5);
void SPIINT()
{
PIR1=0;
SSPCON=0X30;
SSPSTAT=0XC0;
TRISC=0X00;
}
void initial()
{
TRISA=0X00;
INTCON=0X00;
LOCK=0;
}
void SPILED(int data)
{
SSPBUF=data;
do
{;}
while(SSPIF==0);
SSPIF=0;
}
void main()
{
unsigned int i;
initial();
SPIINT();
for(i=5;i>0;i--)
{
data=table;
SPILED(data);
}
LOCK=1;
}
用户1557514 2012-8-22 03:40
用户1624544 2011-9-8 11:16
用户1576512 2011-9-7 12:36