主题中讨论的其他器件:SIMPLELINK-CC13XX-CC26XX-SDK
您好!
我是一个新手、使用传感器控制器和传感器控制器工作室。
当 ADC 超过高阈值时、我需要快速响应。 我想示例 ADC Windows Monitor 就是这样做的。
我刚刚更改了这个示例的 IO 和 adcWindowHigh 限制、当我使用任务测试执行这个示例时、它工作正常。 我可以看到预期的行为和正确的值。


但是、当我将项目导入到 Code Composer Studio 中时、我无法看到相同的行为、中断永远不会发生。
我尝试添加一个易失性变量来持续运行应用程序、但该变量永远不会改变。
这是我的更改代码:
...
// Task data
Task_Struct myTask;
Char myTaskStack[1024];
// Semaphore used to wait for Sensor Controller task ALERT event
static Semaphore_Struct semScTaskAlert;
volatile uint8_t state;
void scCtrlReadyCallback(void) {
} // scCtrlReadyCallback
void scTaskAlertCallback(void) {
// Wake up the OS task
Semaphore_post(Semaphore_handle(&semScTaskAlert));
} // scTaskAlertCallback
PIN_Config pLedPinTable[] = {
Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,
PIN_TERMINATE
};
PIN_State ledPinState;
void taskFxn(UArg a0, UArg a1) {
PIN_Handle hLedPins;
// Enable LED pins
hLedPins = PIN_open(&ledPinState, pLedPinTable);
// Initialize the Sensor Controller
scifOsalInit();
scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
scifInit(&scifDriverSetup);
scifStartRtcTicksNow(0x00010000 / 8);
// Configure and start the Sensor Controller's ADC window monitor task (not to be confused with OS tasks)
scifTaskData.adcWindowMonitor.cfg.adcWindowHigh = 3300;
scifTaskData.adcWindowMonitor.cfg.adcWindowLow = 0;
scifStartTasksNbl(BV(SCIF_ADC_WINDOW_MONITOR_TASK_ID));
// Main loop
while (1) {
// Wait for an ALERT callback
Semaphore_pend(Semaphore_handle(&semScTaskAlert), BIOS_WAIT_FOREVER);
// Clear the ALERT interrupt source
scifClearAlertIntSource();
// Indicate on LEDs whether the current ADC value is high and/or low
if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_LOW) {
PIN_setOutputValue(hLedPins, Board_GLED, 1);
state = 1;
} else {
PIN_setOutputValue(hLedPins, Board_GLED, 0);
state = 2;
}
if (scifTaskData.adcWindowMonitor.output.bvWindowState & SCIF_ADC_WINDOW_MONITOR_BV_ADC_WINDOW_HIGH) {
PIN_setOutputValue(hLedPins, Board_RLED, 1);
state = 3;
} else {
PIN_setOutputValue(hLedPins, Board_RLED, 0);
state = 4;
}
// Acknowledge the alert event
scifAckAlertEvents();
}
} // taskFxn
...
这是调试信息:

当我仅使用 HAL 驱动程序读取同一个 DIO 时、实际上可以读取与 使用任务测试时相同的值。

这是我的 ADC 配置:

我使用:
Sensor Controller Studio:版本2.6.0.132。
Code Composer Studio:版本:11.1.0.00011。
两者都具有 SimpleLink CC13x2 26x2 SDK 3.40.00.02。
提前感谢、
Cristiane Bellenzier Piaia

