Shop OBEX P1 Docs P2 Docs Learn Events
Ctra/ctrb — Parallax Forums

Ctra/ctrb

scottascotta Posts: 168
edited 2008-03-06 20:25 in Propeller 1
How can I get a cog counter to count at the same frequency
as the main system clock (cnt) ?

I don't need to measure external pins, or drive external pins,
just accumulate at the same rate as CNT.

Scott

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2008-03-06 19:42
     frqa := 1
     frqb := 1
    
    
  • scottascotta Posts: 168
    edited 2008-03-06 19:47
    SO that makes something like:

    movi ctra, #%0_00011_000
    mov frqa, #1
    mov phsa, #0

    Scott
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-03-06 20:09
    The last line isn't necessary. Registers are zeroed before loading the program and psha is not a register which is affected by the initialization process (so it's still 0).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • deSilvadeSilva Posts: 2,967
    edited 2008-03-06 20:09
    No, you should better use
          movi    ctra,   #%0_11111_000           
    
    


    All you need to know about timers is contained in Table 4.7 in the Manual (or in the data sheet) and in this diagram here (I don't know why it is not in the datasheet - at an exposed place!)

    It takes me generally 20 minutes - using it - to explain ALL ASPECTS of the timers... all right: it's a stressy 20 minutes for the audience...

    Post Edited (deSilva) : 3/6/2008 8:14:31 PM GMT
    650 x 586 - 33K
  • scottascotta Posts: 168
    edited 2008-03-06 20:25
    Thanks deSilva !

    Scott
Sign In or Register to comment.