我这个线程创建成功了,为啥ai_thread_entry()函数不运行呢?
void airun_thread()
{
/* 创建 serial 线程 */
rt_thread_t thread = rt_thread_create("ai", ai_thread_entry, RT_NULL, 1024, 28, 30);
/* 创建成功则启动线程 */
if (thread != RT_NULL)
{
rt_pin_write(LED2,PIN_LOW);
rt_thread_startup(thread);
}
}
void ai_thread_entry(void *param)
{
while(1)
{
PT1=getaibyChanel(ADC_DEV_NAME0,0);
PT2=getaibyChanel(ADC_DEV_NAME0,1);
PT3=getaibyChanel(ADC_DEV_NAME0,2);
PT4=getaibyChanel(ADC_DEV_NAME0,3);
//临时方案,关闭AD通道,设置为普通输入通道
rt_pin_mode(GET_PIN(A, 0), PIN_MODE_INPUT);
rt_pin_mode(GET_PIN(A, 1), PIN_MODE_INPUT);
rt_pin_mode(GET_PIN(A, 2), PIN_MODE_INPUT);
rt_pin_mode(GET_PIN(A, 3), PIN_MODE_INPUT);
AI1=getaibyChanel(ADC_DEV_NAME1,4);
AI2=getaibyChanel(ADC_DEV_NAME1,5);
AI3=getaibyChanel(ADC_DEV_NAME1,6);
//AI4=getaibyChanel(ADC_DEV_NAME0,7);
PT1old=getPToldValue(PT1);//2.8432875
PT2old=getPToldValue(PT2);
PT3old=getPToldValue(PT3);
PT4old=getPToldValue(PT4);
rt_uint16_t u1=0.254767386299465*PT1old-55.8156683028539;
rt_uint16_t u2=0.254767386299465*PT2old-55.8156683028539;
AI1old=AI1/4;
AI2old=AI2/4;
AI3old=AI3/4;
rt_pin_write(LED3,PIN_LOW);
rt_thread_mdelay(500);
}
}
下载调试的时候现象是LED2正常亮 LED3不会亮,调试的时候不管断点在void ai_thread_entry(void *param)
函数的任意位置 都执行不到,求大佬们解答
栈空间调大了1倍就可以跑了