以下是A7325(发送方)和A7125(接收方)通信的官方范例main函数,请知道的解释一下为什么收发双方的工作频率是不同的,收发双方的工作频率应该怎么怎么设置:
/*********************************************************************
* main loop
*********************************************************************/
void main(void)
{
//initsw
PMR |= 0x01; //set DME0
//initHW
P0 = 0xFF;
P1 = 0xFF;
P2 = 0xFF;
P3 = 0xFF;
P4 = 0x0F;
InitTimer0();
initUart0();
TR0=1; //timer0 on
EA=1; //enable interrupt
if ((P4 & 0x04)==0x04) //if P4.2=1, master
{
initRF_M(); //init RF
StrobeCmd(CMD_PLL);
SetCH(100); //freq 2450MHz
while(1)
{
WriteFIFO(); //write data to tx fifo
SetCH(100);
StrobeCmd(CMD_TX); //entry tx & transmit
while(GIO1); //wait transmit completed
Delay10ms(5);
}
}
else //if P4.2=0, slave
{
initRF_S(); //init RF
RxCnt = 0;
Err_ByteCnt = 0;
Err_BitCnt = 0;
ET0 = 1;//off timer intertupt
TR0 = 1; //timer0 on
StrobeCmd(CMD_PLL);
SetCH(96); //freq 2448MHz
while(1)
{
StrobeCmd(CMD_RX);
while(GIO1); //wait receive completed
RxPacket();
Delay1ms(15);
}
}
}
|