我接手一个关于曼彻斯特编码的程序,但是没有看懂什么意思网上找资料也没有看到有价值的。。用的是125khz低频通信的曼彻斯特编码格式,曼彻斯特编码波特率为3900bit/s。程序如下:
void LF_FSK_senddata(void)
{
static uint8_t send_buf=0,send_ct=0;
//-----------------------------------------------------
if((send_ct<122)&&(LF_FSK_send_flag!=0))
{
switch(send_ct)
{
case 0:send_buf=0xff;break;
case 16:send_buf=0xff;break;
case 32:send_buf=0xff;break;
case 58:send_buf=~0x5a;break;
case 74:send_buf=~0x5a;break;
case 90:send_buf=~(LF_FSK_command>>8);break;
case 106:send_buf=~LF_FSK_command;break;
default:break;
}
//------------------------------------------
if((send_ct>=40)&&(send_ct<=57))
{
switch(send_ct)
{
case 40:
case 41:
case 42:
case 46:
case 48:
case 49:
case 52:
case 53:
case 56:TM2CH3ON();TM2CH4ON();break;
default:TM2CH3OFF();TM2CH4OFF();break;
}
}
//------------------------------------------
else
{
if((send_ct%2)==0)
{
if((send_buf&0x80)!=0)//send 1
{TM2CH3ON();TM2CH4ON();}
else
{TM2CH3OFF();TM2CH4OFF();}
}
else
{
if((send_buf&0x80)!=0)//send 1
{TM2CH3OFF();TM2CH4OFF();}
else
{TM2CH3ON();TM2CH4ON();}
send_buf<<=1;
}
}
//---------------------------------------------
send_ct++;
}
else
{
send_buf=0;send_ct=0;
TM2CH3OFF();TM2CH4OFF();
//ASK_send_flag=0;
LF_FSK_send_flag=0;
}
}
请教一下大家能不能帮我看下程序流程怎么走的?非常感谢 |