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.

F28004x CLA 延时程序



请问F28004x的CLA 中支不支持 延时函数,如  DELAY_US(1);  或  __asm(" RPT #10 || NOP"); 这样的us级延时函数,或者CLA有没有自己延时函数? 

  • DELAY_US无法在CLA上工作。该函数是用C28x程序集编写的。您可以在CLA汇编中编写一,有可能不会非常精确

    ; \brief CLA delay function
    ; \param[in] N counter in MR0
    ;
    ; This function basically loops "N" times
    ; cycles (SYSCLK) = 2(prologue) + 8*N + 4(epilogue)
    ;
        .global _delay_cla
        .sect "Cla1Prog"
    _delay_cla: 
        .asmfunc
        MMOVIZ  MR1, #0 ; decrement value
        MMOVXI  MR1, #1 
    _delay_cla_loop:
        MSUB32  MR0, MR0, MR1 ; set ZF when MR0 is 0
        MNOP
        MNOP
        MNOP
        MBCNDD  _delay_cla_loop, NEQ
        MNOP
        MNOP
        MNOP
        MRCNDD  UNC
        MNOP
        MNOP
        MNOP
        .endasmfunc

    您可以在.asm文件中定义它,并声明一个原型“ void delay_cla(int32_t N);”。然后将该文件放在CLA包含的头文件中。时间为:2 + 4 + 8N sysclk个周期

    另外可以参考之前的帖子