我在程序中使用for循环延时,由于是空指令,编译器就把我编的代码优化掉了,结果程序中不管循环多少次都是只运行一次。
我在for循环里执行一条j++的语句后(volatile Uint16 j),就可以延时了。不过不知道编译器在哪里可以设置不让它优化。
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.
我在程序中使用for循环延时,由于是空指令,编译器就把我编的代码优化掉了,结果程序中不管循环多少次都是只运行一次。
我在for循环里执行一条j++的语句后(volatile Uint16 j),就可以延时了。不过不知道编译器在哪里可以设置不让它优化。