How to deal with a wrapping counter in embedded C

后端 未结 11 885
时光取名叫无心
时光取名叫无心 2021-02-05 14:23

I need to deal with a counter that gives me ticks for my application. The counter is 32bits so what i need to know is how to deal with it when it wraps. for example:

I h

11条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-05 14:53

    As you are embedded, you may have access to a CPU overflow bit. This would be set when an add overflows it's register. Useful for add AddCarry chaining.

提交回复
热议问题