Shop OBEX P1 Docs P2 Docs Learn Events
Specialized counters — Parallax Forums

Specialized counters

inakiinaki Posts: 262
edited 2006-07-30 00:56 in Propeller 1
Where is explained the use of these 'two specialized counters' that I keep hearing about ?
I was puzzled reading some of the code·writen around·those counters.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • pjvpjv Posts: 1,903
    edited 2006-04-12 18:17
    Hi Inaki;

    I have not searched the field, but I'm not sure if much pulblic information exists about those or the video peripheral. I believe Parallax is writing that stuff up during this period prior to formal release.

    Cheers,

    Peter (pjv)
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-12 18:37
    In order to get some information out, Chip wrote a documented demo; there's a lot left to do, but this should get you started.· Note that this file needs to be opened with a Unicode-compatible viewer using the Parallax·font.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-04-12 19:26
    Where's the Parallax font?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • inakiinaki Posts: 262
    edited 2006-04-12 19:37
    Thanks Jon.

    Wow! I think I need time to assimilate this information. Anyway, now·I understand why these are called 'specialized counters' although 'counters' is a little humble name for such powerful registers.

    I see this subject has a lot of possibilities.·I can even foresee·a book: 'Recipes for·exploiting·Propeller's specialized counters".

    Well at least I expect an article on N&V dedicated to this subject ! ;-)





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-12 19:40
    I attached the Parallax font to a sticky thread in this forum: http://forums.parallax.com/showthread.php?p=581530

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-04-12 19:41
    Yes, once I get a better grasp on the counters I will do an N&V project -- probably my Servo16 object which is a virtual version of our PSC that runs in its own cog.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • edited 2006-07-30 00:56
    I've been playing with the·Counters in a Cog and was having trouble coming up with a simple way to have Counter A change State of “Pin 0” every time the System Counter increments by 12 and Counter B change in increments of 768. I can do Multiples of Two without any·problems; it's multiples of 3 that seem to be difficult.
    ·
    I was able to get the correct clock frequencies out of the code posted above, but,·there was a very small error·so the two clock pulses were not in perfect sync.
    ·
    In my application Pin 1·needs to be exactly·1/64 of Pin 0. ·I can work out timing to sync the two clocks.
    ·
    Maybe I'm completely·unable to grasp the concept. Maybe·someone could help shed some light on these wonderful counters·since little documentation is currently available for them, that I can find.
    ·
    Here is the code I’ve been using to test the counters.· Currently it is set to output 40MHz on pins 0 and·1.
    CON _clkmode = xtal1 + pll16x
    _xinfreq = 5_000_000
    PUB Start
    cognew(@Output, 0)                                      'Launch Code
    DAT
    '-------------------------------------------------------------------------------- 
    Output        org       0                               'Begin at Cog RAM addr 0
                  mov       dira, Pins                      'Set All Pins to output
                  
                  mov       ctra,CTRA_MODE                  'Setup CTRA
                  mov       frqa,FREQA
                  mov       phsa,PhaseA
                  
                  mov       ctrb,CTRB_MODE                  'Setup CTRB
                  mov       frqb,FREQB
                  mov       phsb,PhaseB 
    
    :loop
                  {main code here}
                  jmp       #:loop
    Pins          long      $FFFFFFFF                       'All Pins Output
    CTRA_MODE     long      $10000001                       'NCO Single Ended Output Pin 0 ($0B800000 PLL x16 /128 SEO)
    CTRB_MODE     long      $10000001                       'NCO Single Ended Output Pin 1
    FREQA         long      $80000000                       '40 MHz
    FREQB         long      $80000000                       '40 MHz
    PhaseA        res       1
    PhaseB        res       1
    

    -Dan

    Post Edited (Direct Digital Labs) : 7/31/2006 3:09:12 PM GMT
Sign In or Register to comment.