Shop OBEX P1 Docs P2 Docs Learn Events
Timing question for kuroneko — Parallax Forums

Timing question for kuroneko

Cluso99Cluso99 Posts: 18,069
edited 2012-04-12 00:51 in Propeller 1
kuroneko: As the resident expert, i wanted to ask how to best do the following....

I want to generate a clock output with 4 clocks high and 4 clocks low. That is easy enough. Now, I need to have the cog exactly timed to increment a group of output pins (being used to increment an sram address) 2 clocks after the output clock pin goes high. With internal prop timings I may need to make this 1 or 3, but itwill be fixed.

What I am trying to do is log 8 data pins into sram every 8 prop clocks (512KB samples) triggered by a sequence of events.

So the cog once running will be in a 2 instruction loop, being add and djnz.

What I anticipate doing is to inc phsa each 4 clocks withfrqa=$2000-0000. I presume to get the clock offset I will preset phsa. Am I on the right track?

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2012-04-12 00:42
    having problems fixing error with my xoom. Should be $4000-0000
  • kuronekokuroneko Posts: 3,623
    edited 2012-04-12 00:51
    Cluso99 wrote: »
    What I anticipate doing is to inc phsa each 4 clocks withfrqa=$2000-0000. I presume to get the clock offset I will preset phsa. Am I on the right track?
    Sounds about right. The preset entirely depends on how your code looks like (for 10MHz you want to keep activation closer to the loop), e.g.
    movi    ctra, #%0_00100_000     ' NCO
    movi    frqa, #%0010_00000      ' 10MHz
    
    add     A, B
    djnz    C, #$-1
    
    The first active counter increment (phsx += frqx) happens during the first cycle of addS. So the clock (assuming phsx starts with 0) goes high during addR which is also when the result of add is written (i.e. becomes active). Which means you'd have to preload phsx with e.g. 2*frqx ($4000_0000, 2 cycles later $8000_0000).
Sign In or Register to comment.