AnsweredAssumed Answered

Instructions take longer than expected

Question asked by Chris K on Oct 13, 2017

I am trying to write very tight loops in assembly. Looking at the programming guide, I see how many cycles each instruction should take. However, when I execute the code, the instructions take longer than I would expect. For example, both a nop and a cp should be one cycle. But if I replace a bunch of nops with cps, the timing changes. This seems strange to me. I cant tell exactly how far off they are, but slightly. I am running at 16MHz, and if I use bset/bres to set and clear a GPIO (also supposed to be one cycle) and verify it on a scope, it is clearly taking longer than one cycle.