display_c( 0,4,DisplayBuf );
}
void delay_ns(uint ns)
{
uint i;
for(i=0;i<ns;i++)_nop_();
}
uchar SPIReadByte()// ¶áSPIêy¾Y
{
uchar i; // Counter used to clock out the data
uchar dat;
// dat=0;
for(i=0;i<8;i++) // Prepare to clock in the data to be read
{
dat<<=1; // Rotate the data
spi_ck=0; // Raise the clock to clock the data out of the MAX7456
if(spi_miso)dat|=0x01;
spi_ck=1; // Drop the clock ready for the next bit
} // and loop back
return dat; // Finally return the read data
}
void SPIWriteByte(uchar dat)// D′SPIêy¾Y
{
uchar i; // Counter used to clock out the data
for(i=0;i<8;i++)
{
if(dat&0x80)spi_mosi=1;
else spi_mosi=0;
_nop_();_nop_();
spi_ck=0;_nop_();_nop_();
spi_ck=1;_nop_();_nop_();
dat<<=1;
}
}
uchar ReadRawRC(uchar address)//¶áRC632¼Ä′æÆ÷Address[IN]:¼Ä′æÆ÷μØÖ·
{
uchar ucAddr;
uchar ucResult=0;
spi_cs=0;
ucAddr=((address<<1)&0x7E)|0x80;
SPIWriteByte(ucAddr);
ucResult=SPIReadByte();
spi_cs=1;
return ucResult;
}
void WriteRawRC(uchar address,uchar value)//D′RC632¼Ä′æÆ÷Address[IN]:¼Ä′æÆ÷μØÖ·
{
uchar ucAddr;