After calling individual sub-functions of avr program, the next program is not executed (for example, the delay sub-function cannot be used)

static void delay(uint j)
{ volatile uint i; for(i=0;i<j;i++) { asm volatile("nop"); } } This volatile keyword needs to be added to prevent the compiler from optimizing it ; Remember to add static in the function header, so if you call this delay sub-function, there should be no problem







Guess you like

Origin blog.csdn.net/weixin_43128203/article/details/88726363