Part Number: TMS320F28377D
我现在在main函数中的for函数中加入连接的串口触摸屏的按键,我想通过按键控制定时器的开关,但现在一运行就会强制跳转到开启定时器那一行,这是为什么
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: TMS320F28377D
我现在在main函数中的for函数中加入连接的串口触摸屏的按键,我想通过按键控制定时器的开关,但现在一运行就会强制跳转到开启定时器那一行,这是为什么
for(;;)
{
DELAY_US(10000);
while(rdataB[5]==0xFFFF);
DINT;
switch (rdataB[5])
{
case 0x01:
StartCpuTimer0();
scia_xmit_int(clear_text, 7);
write_fx_word(Sample_Data_A.fx, Sample_Data_B.fx, Sample_Data_C.fx);
Data_Storage1(&Sample_Data_A);//处理第五组数据
break;
case 0x02:
scia_xmit_int(clear_graph, 6);
write_tc_word(Sample_Data_A.Tc,Sample_Data_B.Tc,Sample_Data_C.Tc);
write_Br_1word(Sample_Data_A.Br);
int i;
for(i=0;i<650;i=i+1)
{
if (Sample_Data_A.Sample_Mode == 3 && Sample_Data_B.Sample_Mode == 0 && Sample_Data_C.Sample_Mode == 0)
{
sendgraph(CH_SET, &Sample_Data_A.Tc_Data[2][i], &Sample_Data_B.Tc_Data[2][i], &Sample_Data_C.Tc_Data[2][i]);
}
}
break;
default:
break;
}
rdataB[5]=0xFFFF;
EINT;
}
}
串口中断,根据switch判断按了那个按键,开启定时器写到那个按键就直接运行那个按键,不知道是什么原因,是不是定时器中断优先级高于串口接收中断的优先级
for(;;)
{
DELAY_US(10000);
while(rdataB[5]==0xFFFF);
DINT;
switch(rdataB[5])
{
case 0x01:
StartCpuTimer0();
scia_xmit_int(clear_text, 7);
write_fx_word(Sample_Data_A.fx, Sample_Data_B.fx, Sample_Data_C.fx);
Data_Storage1(&Sample_Data_A);//处理第五组数据
break;
case 0x02:
scia_xmit_int(clear_graph, 6);
write_tc_word(Sample_Data_A.Tc,Sample_Data_B.Tc,Sample_Data_C.Tc);
write_Br_1word(Sample_Data_A.Br);
int i;
for(i=0;i<650;i=i+1)
{
if (Sample_Data_A.Sample_Mode == 3 && Sample_Data_B.Sample_Mode == 0 && Sample_Data_C.Sample_Mode == 0)
{
sendgraph(CH_SET, &Sample_Data_A.Tc_Data[2][i], &Sample_Data_B.Tc_Data[2][i], &Sample_Data_C.Tc_Data[2][i]);
}
}
break;
default:
break;
}
rdataB[5]=0xFFFF;
EINT;
}
但现在一运行就会强制跳转到开启定时器那一行
你的意思是按了按键之后,代码就会运行到第9行的‘StartCpuTimer0();’处吗?