資源描述:
《fsk解碼原理和實現(xiàn)方法》由會員上傳分享,免費在線閱讀,更多相關內(nèi)容在行業(yè)資料-天天文庫。
1、FSK解碼原理及實現(xiàn)方法1.解碼數(shù)學原理條件:???FSK的頻率為:1200/2200-->1/0;???wc=1700,即(1200+2200)/2,設delta=+500/-500;???T是采樣周期???則:???????1200可表示為cos((wc-delta)*t);???????2200可表示為cos((wc+delta)*t);設第n次采樣值為cos((wc+/-delta)*(t-T)),第n+1采樣值為cos((wc+/-delta)*t).有:value(n)*value(n+1)=cos((wc+/-delta)*t)*cos((wc+/-delta)*(t-T))?
2、=[cos((wc+/-delta)*t+(wc+/-delta)*(t-T))+cos((wc+/-delta)*t-(wc+/-delta)*(t-T))]/2=[cos(2*(wc+/-delta)*t-(wc+/-delta)*T)+cos((wc+/-delta)*T)]/2???????????(1)???????(H)???????????????(L)將(1)式通過一個低通濾波器,則(1)式的(H)項即2位頻率被濾掉,只剩下(L)項:(1)--->Lowpassfilter--->cos((wc+/-delta)*T)再看:???cos((wc+/-delta)*T)=cos
3、(wc*T+/-delta*T)???(2)???IF:???wc*T=PI/2??????則cos(wc*T+/-delta*T)=cos(PI/2+/-delta*T)??????????????????????=-/+sin(delta*T)???(3)(3)式則是FSK的值,2.濾波器.???對于來電顯示,下面這段程序可以達到解碼的要求???定義:???#define???FSKBUF4???byte???g_cADCResult;//A/D的采樣值???int???currentx,currenty,lastx,last_sample;???int???g_iFSKBuf[FSKB
4、UF];???int???g_iFSKAvg;???int???g_iFSKBuf1[FSKBUF];???int???g_iFSKAvg1;???int???g_iFSKBuf2[FSKBUF];???int???g_iFSKAvg2;???byte???g_cFSKBufPoint;???//在濾波之前將變量初化為0???程序?qū)崿F(xiàn):(每次采樣要做以下工作,注意采樣頻率和CID的波特率不是倍數(shù)關系???currentx=g_cADCResult;???currenty=last_sample;???last_sample=currentx;???//lastsampleincurrenty
5、,nowsampleincurrenx;???currenty?*=currentx;//cos(t)*cos(t-T)=-/+sin(delta*T);???//------avg--lowpassfilter;???g_iFSKAvg-=g_iFSKBuf[g_cFSKBufPoint];???g_iFSKBuf[g_cFSKBufPoint]=currenty;???g_iFSKAvg+=currenty;???currenty=g_iFSKAvg;???//---------endfilter;???g_iFSKAvg1-=g_iFSKBuf1[g_cFSKBufPoint];???
6、g_iFSKBuf1[g_cFSKBufPoint]=currenty;???g_iFSKAvg1+=currenty;???currenty=g_iFSKAvg1;???//secondfilterover???g_iFSKAvg2-=g_iFSKBuf2[g_cFSKBufPoint];???g_iFSKBuf2[g_cFSKBufPoint]=currenty;???g_iFSKAvg2+=currenty;???currenty=g_iFSKAvg2;???//thirdfilterover???g_cFSKBufPoint++;???g_cFSKBufPoint%=FSKBUF;?
7、??if(currenty>0)???{???????//接收到bit1???}???else???{???????//接收到bit0???}