|
发表于 2012-7-30 14:08:14
|
显示全部楼层
johnny_dxj 发表于 2012-7-30 14:03 ![](static/image/common/back.gif)
我现在这个只是测试程序,收发寄存器配置都是一样的,串口发送出去,收到后通过CC1100E发出,另一个CC1100e接收 ...
以下是发送程序:Tx_buffer首字节为目标板地址
void Spi_Write_Packet(unsigned char *Tx_buffer,unsigned char size)
{
unsigned char i;
Spi_Write_Byte(CC_TXFIFO,size); //Write size to TXFIFO
Spi_Write_Burst(CC_TXFIFO,Tx_buffer,size); //Write daat to TXFIFO
Spi_Write_Strobe(CC_STX); //Start transmit
i = 0;
while (GDO0_L) //Wait GDO0 to be set
{
if (i > 10) break; //Overtime jump out---------------------
delay_us(300);
i++;
}
i = 0;
while (GDO0_H) //Wait GDO0 to be clear
{
if (i > 10) break; //Overtime jump out-------------------------
delay_us(300);
i++;
}
delay_us(300); //May be remove TBD test----------------------
Spi_Write_Strobe(CC_SFTX); //Clear TXFIFO
Spi_Write_Strobe(CC_SIDLE); //Go to sidle
Spi_Write_Strobe(CC_SRX); //Go to RX mode
} |
|