How to delay an ARM Cortex M0+ for n cycles, without a timer?

后端 未结 2 533
闹比i
闹比i 2021-01-03 04:32

I want to delay an ARM Cortex M0+ for n cycles, without using a timer, with the smallest possible code size. (I think this mandates use of assembly.)

A delay of 0 c

2条回答
  •  时光说笑
    2021-01-03 05:21

    The shortest ARM loop that I can think of goes like:

    mov r0, #COUNT
    L:
    subs r0, r0, #1
    bnz L
    

    Since I don't have the device in question, no idea about timing. Those are core dependent.

提交回复
热议问题