How to use a variable as a parameter in a function that only suports constant expresssion

前端 未结 3 603
南笙
南笙 2021-01-20 21:02

I\'m using this function:

__delay_cycles(var); 

and I get the following error:

Argument to _delay_cycles

3条回答
  •  旧时难觅i
    2021-01-20 21:33

    Don't use that function. It is apparently some non-standard Texas junk that doesn't behave according to the rules of the C language. Write your own delay function using on-chip timers instead, or find one on the net. Takes less than 1 hour of work, which is no doubt less time than you will spend pondering the meaning of various non-standard junk.

    The real reason why the embedded industry have so many crappy compilers, is because embedded programmers accept to be constantly fed with non-standard junk, even when there is no reason what-so-ever to deviate from the C standard.

提交回复
热议问题