PDA

View Full Version : SquareWave change frequency without interrupt last cycle



Julian800
06-01-2010, 01:47 PM
Hi All,
I am doing some squire ware frequency change in high speed (1ms update). By using SquareWave Object, it change Frequency (FRQA register ) without knowing last square ware cycle finished or not. I know the PHSA accumulation and decide Pin output. I can use assembly (mov Result, phsa ) read phsa register and go into loop, but what value I should wait for #0 or ??

Phil Pilgrim (PhiPi)
06-01-2010, 01:58 PM
Rather than examining phsa, you could use waitpeq or waitpne to sync to the pin change.

-Phil

Julian800
06-01-2010, 02:23 PM
Hi Phil
thanks for your help. I thing the best way is to change FRQA when pin State change.
In SPIN we could use
waitpeq(%0100, %0100, 0) 'Wait for P2 to be high
waitpne(%0100, %0100, 0) 'Wait for P2 to not match prev. state

FRQA:= xxxx

Post Edited (Julian800) : 6/1/2010 6:29:52 AM GMT