器件型号:MSP432E411Y
工具/软件:Code Composer Studio
感谢您始终友好地回答我的问题。
我尝试不是连续而是非连续使用 ADC 引脚。
因此、我编写了参考示例代码的 ADC 信号通道的代码。
ADC0和 ADC1线程被创建并且每个线程接收数据100次。
我猜是 ADC0、ADC1将使用交替函数运行、但 ADC0将运行100次、ADC1将运行100次。
此外、定时器也被置位、但是定时器在功能完成后进入。
在调试模式下逐个运行来确认该问题。
Thread 是否运行不好?
这是我的代码。
|
#include #include #include "ti_drivers_config.h"
#define THREADSTACKSIZE (768) /* ADC 转换结果变量*/ extern void senddata (char* adcname、int time、int adcresult); void timerCallback (Timer_handle myHandle、int_fast16_t 状态); int sec = 0; void *线程 Fxn0 (void * arg0) ADC_PARAMS_INIT (params); if (ADC == NULL){ 对于(I = 0;I < ADC_SAMPLE_COUNT;I++){ if (res == ADC_STATUS_SUCCESS){ adcValue0MicroVOL[i]= adc_convertRawToMicroVolts (ADC、adcValue0[i]); ADC_Close (ADC); 返回(空); void *线程 Fxn1 (void * arg0) ADC_PARAMS_INIT (params); if (ADC == NULL){ 对于(I = 0;I < ADC_SAMPLE_COUNT;I++){ if (res == ADC_STATUS_SUCCESS){ adcValue1Microvol[i]= adc_convertRawToMicroVolts (adc、adcValue1[i]); ADC_Close (ADC); 返回(空); void * mainThread (void * arg0) pthread_t thread0、thread1;
timer_init(); Timer_Params_init (¶ms); timer0 = Timer_open (CONFIG_TIMER_0、params); if (timer0 == NULL){ 如果(Timer_start (timer0)= Timer_STATUS_ERROR){
pthread_attr_init (atttrs); detachState = pthread_create_detached; pthread_create (&thread0、&attrs、threadFxn0、(void*) 0); 返回(空); 空 timerCallback (Timer_handle myHandle、int_fast16_t 状态) |