Shop OBEX P1 Docs P2 Docs Learn Events
How fast can a cog count? — Parallax Forums

How fast can a cog count?

Carl HayesCarl Hayes Posts: 841
edited 2008-12-25 08:07 in Propeller 1
I'm in very preliminary design on a device that will require counting a 1.44 MHz signal (from a crystal oscillator) and producing the following outputs:

(1)· a 40 KHz square wave (to feed an LMF100 filter that's running bandpass at 800 Hz·with a frequency ratio of 50).

(2)· an output that is a count from 0 through 359, cycling 800 times per second (a degree counter).· This can be in common storage for another cog to read, or can be in binary on 9 output pins for another cog to read (to avoid hub delays).· I can if necessary devote 9 I/O pins for that, but I druther not (as we say in the Sunny South).

(3)· six outputs on pins, one ON at a time, cycling as a ring counter 800 times per second (switching from one output to the next 4800 times per second).· These will switch antennas in a six-antenna Adcock direction-finding array.

I can easily build this in TTL, but would rather put it in a single cog if feasible, because it takes less space and there's going to be a Propeller in the system anyway (doing other calculations).

Can a cog count cycles·that fast (1.44 MHz)?· Can it do it in Spin?· Can it do it in assembler?· I could determine it by experiment, of course, but if the answer is a clear no I will have saved the time.

If there's anything dumb in the above, don't hesitate to say so.

And, oh, Merry Christmas.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· -- Carl, nn5i@arrl.net

Post Edited (Carl Hayes) : 12/25/2008 4:32:22 AM GMT

Comments

  • JasonDorieJasonDorie Posts: 1,930
    edited 2008-12-25 04:39
    At that rate, you'd have 13 instructions at 20MHz between cycles. A wait instruction for the pin transition and the branch for the loop counts as two (I think). If you can do the rest in ~10 instructions you're in business. With some clever programming you might pull it off, or you could try overspeeding the prop to gain a few more instructions. It'd be pretty tight, but could be possible.

    Jason
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-12-25 04:46
    Hmmm -- looks a little iffy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
  • BradCBradC Posts: 2,601
    edited 2008-12-25 06:42
    Can't be that hard. It can do USB NRZI encoding at 1.5Mhz... It'd count standing on its ear with 5 cogs tied behind its back!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cardinal Fang! Fetch the comfy chair.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-25 06:59
    You can use multiple cogs to count the same input, each producing a different output. Probably #2 and #3 can be handled by one cog and #1 by another cog.
  • Carl HayesCarl Hayes Posts: 841
    edited 2008-12-25 08:07
    Mike Green said...
    You can use multiple cogs to count the same input, each producing a different output. Probably #2 and #3 can be handled by one cog and #1 by another cog.
    Thanks.· Either that, or TTL for some and a cog for others.· I think multiple cogs, as you suggest, probably will end up most economical.· The only one of those results that is input to any further processing is the count-to-360, which is a degree counter indicating the direction of arrival of a radio signal; so that one should be a cog, and the others perhaps not.

    Another cog will be calculating the mean of 100 such 0-to-359 measurements, which is surprisingly complex because of the vector nature of the measurement; another will be taking that number, processing input from a compass, and calculating a true bearing; another will be taking that and combining it with GPS information to calculate a line-of-position for the transmitter; another will be calculating intersections between measured lines of position (this system will be in a moving vehicle); and a PC will be plotting such intersections on a map.

    Another cog may be identifying separate transmitters by different characteristics of their transmitted signals (no two transmitters settle on frequency in exactly the same way);·but I don't know how to do that, yet.

    Zeesh, that's seven cogs so far.· One more to be the straw boss, I guess.


    Joyeuse Noël

    Fröhliche Weihnachten

    Feliz Navidad

    Mele Kalikimaka

    Szczęśliwy Boże Narodzenie

    Ummm, lessee -- oh, yes, Merry Christmas!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · -- Carl, nn5i@arrl.net
Sign In or Register to comment.