Shop OBEX P1 Docs P2 Docs Learn Events
SquareWave change frequency without interrupt last cycle — Parallax Forums

SquareWave change frequency without interrupt last cycle

Julian800Julian800 Posts: 31
edited 2010-06-01 06:23 in Propeller 1
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 ??

Comments

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

    -Phil
  • Julian800Julian800 Posts: 31
    edited 2010-06-01 06:23
    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
Sign In or Register to comment.