__builtin_propeller_waitcnt()
JonnyMac
Posts: 9,529
in Propeller 1
What is the purpose of param1 in __builtin_propeller_waitcnt(target, param1)?

Comments
To get the same functionality, you need to use the return value of __builtin_propeller_waitcnt which is target+param1, since In C parameters are passed by value so any modification is local to the function.
See also the waitcnt and waitcnt2 helper functions.
It's used to update the target time for the next waitcnt:
targetCnt = CNT + freq; // set up initial interval do { // do something useful that takes less than "freq" cycles ... // now sleep until interval is finished targetCnt = __builtin_propeller_waitcnt(targetCnt, freq); // targetCnt has been updated to the next CNT to wait for } while (condition);