How do you calculate if delta time has elapsed in PASM?
turbosupra
Posts: 1,088
Through searching, I saw an example that used frqa and phsa, but I tried that and it did not work and then I realized I am already using frqa and frqb as counters for something else
In spin I would do something like (cnt-timeStamp > clkfreq)
I tried to do the same in pasm, but I don't know if this is a legal operation, I tried to do something with sub, but that didn't work either. Also, do I have to use if_C_OR_Z for each line after a compare, since there is no indentation or brackets in pasm?
gapCntAsm is just an incrementing counter based on certain conditions and it does increment because I can see it doing so in the terminal
Thanks for reading my newb question.
In spin I would do something like (cnt-timeStamp > clkfreq)
I tried to do the same in pasm, but I don't know if this is a legal operation, I tried to do something with sub, but that didn't work either. Also, do I have to use if_C_OR_Z for each line after a compare, since there is no indentation or brackets in pasm?
gapCntAsm is just an incrementing counter based on certain conditions and it does increment because I can see it doing so in the terminal
cmp (cnt-timeStamp), #delta WZ,WC 'test if delta time reached or exceeded, C should be 1 or Z should be 1 if_C_OR_Z mov gapCntAsmPeak, gapCntAsm ' copy the gapCnt to gapCntPeak if_C_OR_Z wrlong gapCntAsmPeak, gapCntAsmPeakptr ' update the hubram value if_C_OR_Z mov timeStamp, cnt ' -------------------------------------------------------------------------------------------------- delta long 80_000_000
Thanks for reading my newb question.
Comments
You do have to have the condition on each line where you want it to take effect. It's perfectly legitimate to have one condition on two lines, then none, then another on a line, etc.
I personally just use the c flag because I think it simplifies the coding a bit.