Amiccom RF IC A7196 WOR(低功耗接收)
上篇介紹了A7169 WOR 功能,本篇換介紹使用A7196 的WOR功能
代碼:
RC_A8107x7196_Reference code WOR mode.zip
(一).代碼說明:
1.設定Sleep time & Active time
//WOR setting A7196_WriteReg(RCOSC1_REG,0x09); //sleep time = [(9+1)*32/4000]*1000=80ms A7196_WriteReg(RCOSC2_REG,0x13); //active time = (20/4000)*1000=5ms
2. 校準RC Oscillator
A7196_WriteReg(0x09, 0x0C); //RCKS[01]=FSYCK RCOSC_E=1 A7196_WriteReg(0x02, 0x20); //RC Oscillator calibration enable do { tmp=A7196_ReadReg(0x02) & 0x20; } while(tmp);
3. 設定GIO1=WTR(當進入WOR時,可以觀察此PIN是否有Sleep(LOW)/Active(HIGH)變化/GIO2=WOR Wake Up PIN(觀察WOR是否成功喚醒)
A7196_WriteReg(GPIO1_REG, 0x01); //GIO1 WTR A7196_WriteReg(GPIO2_REG, 0x11); //gio2 MCU wake up(TWOR)
4.WORE=1,進入Sleep mode,等待GIO2拉HIGH(表示已經成功喚醒)
while(1) { //WOR En A7196_WriteReg(MODECTRL_REG,0x6A); //WORE active time = 20/4000 A7196_StrobeCmd(CMD_SLEEP); while(~GIO2); //wait receive completed Delay1ms(1); A7196_RxPacket(); }
P.S. 當進入Sleep時可以觀察GIO1,是否類似下圖Sleep(LOW)/Active(HIGH)變化,表示已進入WOR MODE
(二).功耗計算:
找到Amiccom提供的手冊上,sleep mode時的電流3uA,RX mode時為29mA
在套用代碼上設定的Sleep time=80ms,Rx Active time=5ms,計算出平均電流約為1.709mA