产品编号:CC1310系列
while(1){ AONBatMonEnable(); // TEMPUPD.STAT = 1; uint32_t inputt= AONBatMonTemperatureGetDegC(); #define AON_BATMON_O_TEMP 0x00000030 int32_t inputy = (int32_t)inputt; // 将uint32_t转换为int32_t input[0] = inputt & 0xFF; //input[0] = 1; // 用于存储拆分后的两部分的数组 //// 将int32_t变量拆分为两部分 //uint16_t part1 = (inputy & 0xFFFF); // 取低16位 //uint16_t part2 = ((inputy >> 16) & 0xFFFF); // 取高16位 // //// 将拆分后的两部分存储到数组中的第一个和第二个槽内 //input[0] = (uint8_t)(part1 & 0xFF); // 低八位存储在第一个槽内 //input[1] = (uint8_t)(part2 & 0xFF); // 高八位存储在第二个槽内 // PIN_setOutputValue(ledPinHandle, CC1310_LAUNCHXL_PIN_RLED , !PIN_getOutputValue(CC1310_LAUNCHXL_PIN_RLED )); // usleep(10000); // PIN_setOutputValue(ledPinHandle, CC1310_LAUNCHXL_PIN_RLED , !PIN_getOutputValue(CC1310_LAUNCHXL_PIN_RLED )); // UART_write(uart, &input, 2); Task_sleep(sleepTickCount); AONBatMonDisable (); /* Request access to the radio */ #if defined(DeviceFamily_CC26X0R2) rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioSetup, &rfParams); #else rfHandle = RF_open(&rfObject, &RF_prop, (RF_RadioSetup*)&RF_cmdPropRadioDivSetup, &rfParams); #endif// DeviceFamily_CC26X0R2 // RF_cmdPropRadioDivSetup.txPower=0x913F; //设置频率 RF_CmdHandle txTestHnle=RF_postCmd(rfHandle, (RF_Op*)&RF_cmdFs, RF_PriorityNormal, NULL, 0); /* Create packet with incrementing sequence number and random payload */ packet[0] = input[0]; uint8_t i; for (i = 1; i < PAYLOAD_LENGTH; i++) { packet[i] = 1; } xor_encrypt_decrypt(packet, key, PAYLOAD_LENGTH); /* Send packet */ RF_EventMask terminationReason = RF_runCmd(rfHandle, (RF_Op*)&RF_cmdPropTx, RF_PriorityNormal, NULL, 0);//stuck on this step switch(terminationReason) { case RF_EventLastCmdDone: // A stand-alone radio operation command or the last radio // operation command in a chain finished. break; case RF_EventCmdCancelled: // Command cancelled before it was started; it can be caused // by RF_cancelCmd() or RF_flushCmd(). break; case RF_EventCmdAborted: // Abrupt command termination caused by RF_cancelCmd() or // RF_flushCmd(). break; case RF_EventCmdStopped: // Graceful command termination caused by RF_cancelCmd() or // RF_flushCmd(). break; default: // Uncaught error event while(1); } uint32_t cmdStatus = ((volatile RF_Op*)&RF_cmdPropTx)->status; switch(cmdStatus) { case PROP_DONE_OK: // 传输包成功 break; case PROP_DONE_STOPPED: // received CMD_STOP while transmitting packet and finished // transmitting packet break; case PROP_DONE_ABORT: // Received CMD_ABORT while transmitting packet break; case PROP_ERROR_PAR: // Observed illegal parameter break; case PROP_ERROR_NO_SETUP: // Command sent without setting up the radio in a supported // mode using CMD_PROP_RADIO_SETUP or CMD_RADIO_SETUP break; case PROP_ERROR_NO_FS: // Command sent without the synthesizer being programmed break; case PROP_ERROR_TXUNF: // TX underflow observed during operation break; default: // Uncaught error event - these could come from the // pool of states defined in rf_mailbox.h while(1); } #ifndef POWER_MEASUREMENT // PIN_setOutputValue(ledPinHandle, Board_PIN_LED1,!PIN_getOutputValue(Board_PIN_LED1)); #endif /* Power down the radio */ RF_yield(rfHandle); #ifdef POWER_MEASUREMENT /* Sleep for PACKET_INTERVAL s */ sleep(PACKET_INTERVAL); #else /* Sleep for PACKET_INTERVAL us */ usleep(PACKET_INTERVAL); #endif RF_cancelCmd(rfHandle,txTestHnle,0); // RF_flushCmd (rfHandle,txTestHnle,1); //擦除 RF_yield(rfHandle); //断电 RF_close(rfHandle); }
以上是我的代码段,我发现调用AONBatMonDisable ()μ 温度变成恒定的0x0A是什么原因,打开AONBatMon,如果不调用AONBatMonDisable ();就不会出现这个问题,如何解决?因为我想关掉它,降低功耗。此外,使用这个测温是否精确,精度是多少 μ 我发现测温似乎有延迟,说明书上写着:测温需要一个周期是多久?还有我使用433MHZ,?,15dB,发现功率达到Tx,功率过高,是使用3,6V供电,感谢解答。50mA