C文件
__asm(" .sect \".text:softDelayUs\"\n"
" .clink\n"
" .thumbfunc softDelayUs\n"
" .thumb\n"
" .global softDelayUs\n"
"softDelayUs:\n"
" LSR r1,r1,#3\n"
" MUL r0,r1\n"
" SUB r0,#6\n"
" NOP\n"
" NOP\n"
"loop\n"
" SUBS r0,#1\n"
" NOP\n"
" NOP\n"
" BNE loop\n"
" NOP\n"
" bx lr\n");
头文件
extern void softDelayUs(unsigned int usec,unsigned int freq);
上面的代码是我参考网络网络上的,别人用于stm32,然后我自己模仿,用于ccs,仅仅能用于ccs,
示例:延时100us