ok, i had a longer look. it seems this code runs at 32 Mhz. so indeed waitus will not work since it will create too much time. I understand your remark now MWS.
so all you need to do is reduce the nops to compensate for the extra code (index bit lookup). or replace the bit index with a shift and AND. The index bit lookup has different timing depending on the value of the index.
using a virtual port using port0 will reduce the timing with 2 cycles for each set/reset.
↧