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.

C语言加法运行时间长



各位老师,大神好

         小弟遇到一个应用,使用的芯片为28027,采用内部时钟,60MHZ,现在需要在中断中求一个数组后面几个数字的平均值,程序如下:

#pragma CODE_SECTION(FilterBus, "ramfuncs");

void FilterBus(void)
{
    Uint16 k;
    long vbustemp;
    vbustemp=0;
    for(k=2;k<10;k++)
        vbustemp=vbustemp+vBusSensedBuff[k];
    vBus=vbustemp>>3;
}
在主程序中,已经进行代码从flash搬移到RAM中了,中断程序也已经拷贝到RAM区了,可是不知道为什么执行这几条加法指令,通过在该函数的调用前和调用后修改某一个GPIO引脚的方式,通过示波器观察,该段程序的运行时间接近3.6us,感觉仅仅简单的32位数相加,和一次移位,怎么花费这么长的时间呢?谢谢