Shop OBEX P1 Docs P2 Docs Learn Events
high speed counters — Parallax Forums

high speed counters

BebopALotBebopALot Posts: 79
edited 2006-03-27 19:08 in General Discussion
Hi folks, I am currently engaged in a project in which I need 24 bit counters - well actually, not the whole 24, but 19 bits of it. I want to count at 75 MHz. I initially wanted to use dedicated counter ICs for this, but have had difficulty in finding binary counters that can operate above 70MHz. The ones that I can find aren't cascadable and leave me with either 12 or 14 bits, but the right operating frequency. The only 24bit counter I have seen is the CD4045, but its slow relative to the SX and won't run above 30 MHz. My question is this:

1. does it make sense to use the SX as a dedicated 24 bit counter at 75MHz; that is - is it accurate enough? Are cycles frequently skipped?

2. just for the sake of my own curiosity, does anyone know where to find cascadable very high speed binary counters at 75MHz + or large stage counters - e.g.20 -24 bit? I have had a lot of difficulty finding what I need.

Can anybody weigh in?

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-03-18 05:30
    74F series is probably what you are looking for, the 74F579PC should work, digikey has them for $2.31. They are cascadable. An SX wouldnt work because a counting frequncy of 75MHz needs to be read at 150MHz (you have to read the low and high part of the clock), and also it would take some instructions to do the counting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10

    Post Edited (Paul Baker) : 3/18/2006 5:33:04 AM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2006-03-18 06:11
    Paul,

    What if the 75MHz was used to clock the SX? Seems like there might be a solution or a "trick" doing something that way.


    BebopALot,

    Is 75MHz a fixed frequency, or is this the upper limit?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • PJMontyPJMonty Posts: 983
    edited 2006-03-18 07:19
    BebopALot,

    Given that the top end on the SX is pretty much 75 MHz, trying to create a counter that counts an incoming signal at 75 MHz seems poised somewhere between dicey and impossible. There's no way to implement a 19 bit counter without using software, and that means multiple CPU instructions, and that means your SX counter will be ruinning slower than the signal it's trying to count. There might be some tricky deal using the RTCC and one of the input pins, but it all seems a bit dodgy. I'm not saying it's impossible, just not sure if it's really the solution you want.
      Thanks, PeterM
  • BeanBean Posts: 8,129
    edited 2006-03-18 12:49
    You could probably use the SX48 with it's internal·16-bit counter, and have it interrupt on overflow to increament the other bits.
    Depending on what you want to do with the count.
    Could you provide more details about what your trying to accomplish ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    "Wise men know when they're right. The wisest also·know when they're wrong."


    Post Edited (Bean (Hitt Consulting)) : 3/18/2006 1:38:54 PM GMT
  • BebopALotBebopALot Posts: 79
    edited 2006-03-19 21:36
    Thanks Paul and everyone. Its great having such a knowledgable bunch of people. I spent a few hours looking for high speed counters and must have over looked the 74F579PC. Looks like that will work. In answer to Bean I am measuring some ultrasonic signals. But it really helps to have the counts lined up in parallel for processing by FPGA or an SX, which is why I want to use some dedicated binary counters. The counting frequency is high as I am going to use some atypical techniques to push resolution a bit.

    Thanks BBAL
  • dkemppaidkemppai Posts: 315
    edited 2006-03-20 17:20
    BebopALot said...
    Thanks Paul and everyone. Its great having such a knowledgable bunch of people. I spent a few hours looking for high speed counters and must have over looked the 74F579PC. Looks like that will work. In answer to Bean I am measuring some ultrasonic signals. But it really helps to have the counts lined up in parallel for processing by FPGA or an SX, which is why I want to use some dedicated binary counters. The counting frequency is high as I am going to use some atypical techniques to push resolution a bit.

    Thanks BBAL
    http://www.toshiba.com/taec/components/Datasheet/E005165.pdf
    These are rated for 210Mhz...

    So,·how are you planning on interfacing to the SX?·· I'm a little
    interested, because I'm planning on doing some high frequency
    counting stuff with the SX also. (That's why I found these
    counters...· ...Digikey does stock them)

    -Dan


    ·
  • BebopALotBebopALot Posts: 79
    edited 2006-03-21 04:19
    Hi Dan,

    If I am not mistaken, it looks like you are limited to 12 bits on that component as it doesn't appear cascadable - am I correct? But a good find as far as frequency. Here is what I plan to do: I have a trigger signal that is also on a carrier wave. I need for that trigger signal to start the binary counter without the carrier wave stopping it prematurely. I will use the SX to arm then monitor the trigger circuit and "hold" the trigger if it is tripped. Since my carrier frequency is much lower than my trigger speed the SX, even if it missed several cyles at 75 or 50 MHz, will have ample time to hold the trigger before the next carrier wave stops the binary counter prematurely. In this scenario the SX will create a sort of "sample and hold" use of out of faster circuitry. The SX will be "managing" this circuit.
  • dkemppaidkemppai Posts: 315
    edited 2006-03-22 13:27
    BebopALot said...
    Hi Dan,

    If I am not mistaken, it looks like you are limited to 12 bits on that component as it doesn't appear cascadable - am I correct? But a good find as far as frequency. Here is what I plan to do: I have a trigger signal that is also on a carrier wave. I need for that trigger signal to start the binary counter without the carrier wave stopping it prematurely. I will use the SX to arm then monitor the trigger circuit and "hold" the trigger if it is tripped. Since my carrier frequency is much lower than my trigger speed the SX, even if it missed several cyles at 75 or 50 MHz, will have ample time to hold the trigger before the next carrier wave stops the binary counter prematurely. In this scenario the SX will create a sort of "sample and hold" use of out of faster circuitry. The SX will be "managing" this circuit.
    You can take the Q12 output and use it to drive the clock of the next device.
    This way you get a 24 bit counter...·· ...see attachment.

    I guess my hardware is a little simpler. I'm going to build a simple frequency counter
    for·1.8Mhz to 54Mhz, with 500 Hz resolution. I plan on using this for·an automatic
    antenna tuner controller for a ham radio screw driver antenna controller. (A screwdriver
    antenna has an inductor that is tuned with a cordless screwdriver motor as a driver)
    In my case, the hard part will be to scale the voltage (From 1Vp-p to over +300Vp-p)
    into a 5V logic level...·· ...but I think I've got that worked out now.

    -Dan
    1202 x 474 - 116K
  • BebopALotBebopALot Posts: 79
    edited 2006-03-22 14:18
    Dan, its been a while since I cracked open the "TTL cookbook", but I see what you did with Q12. Very good. Have you tried your counter circuit you posted and does it work? Why did you choose the HC4040 instead of the HCT4040 (TTL)? I looked at the datasheet for the 4040 and it appears the frequency is a lot lower than the Toshiba component you posted.
  • BeanBean Posts: 8,129
    edited 2006-03-22 14:50
    I must admit I'm confused. Are you guys trying to measure frequency ? Or do you need an actual count of the pulses ? The counters in the SX48 can count at 1/2 (I think) of the clock frequency. You can also put a prescaler on the signal if you only need 500Hz resolution.

    I have used the SX48 timers a little and they are very capable. If you could explain a little more what exactly you need, I could maybe help you out. BBAL was talking about ultrasonic frequencies, then Dan was talking about 1.8MHz to 54MHz ? Are these two seperate projects ?

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module"·available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module"·available from Parallax for only·$49.95 http://www.parallax.com/detail.asp?product_id=30015
    Product web site: www.sxvm.com

    Coming soon... Cheap 4-digit LED display with driver IC·www.hc4led.com

    "Sometimes it is better to remain silent and be thought a fool, than to speak and remove all doubt."
    ·
  • BebopALotBebopALot Posts: 79
    edited 2006-03-23 04:13
    Hi Bean, I'm using an electronic stopwatch to measure time at 75MHz+ cycles. The overlap is that we both need high speed counters. I was having trouble finding them, he saved me some time.
  • dkemppaidkemppai Posts: 315
    edited 2006-03-24 01:51
    BebopALot said...
    Dan, its been a while since I cracked open the "TTL cookbook", but I see what you did with Q12. Very good. Have you tried your counter circuit you posted and does it work? Why did you choose the HC4040 instead of the HCT4040 (TTL)? I looked at the datasheet for the 4040 and it appears the frequency is a lot lower than the Toshiba component you posted.
    I use the CH4040's in a project at work, and that's where I grabbed that example from.
    I'm still testing the device at home, but am using the Toshiba chips I posted earlier
    for the high speed stuff.

    Bean,
    I'm making a hardware frequency counter.·I need to keep checking·the frequency every
    few milliseconds.·The 4040's with some bus latches make the hardware easy.
    I really·need the multifunction timers for PWM outputs, so can't use them for inputs.

    -Dan
    ·
  • pjvpjv Posts: 1,903
    edited 2006-03-24 04:19
    Hi Bean and All;

    Some while ago I needed some high speed counting done and experimented with the SX to see what it's maximium frequency was. To the best of my recollection it was in the 80 MHz range..... it's free running, and not linked to the SX clock. So making counters of any arbitrary length inside an SX should be easy.

    I'll have a peek again tomorrow and post my findings.

    Cheers,

    Peter (pjv)
  • pjvpjv Posts: 1,903
    edited 2006-03-27 19:08
    Hi All;

    Well, I've finally had a chance to do some testing on this with an SX28 and discovered, contrary to my earlier post,·that the RTCC can be clocked from an external source·only up to half the rate of the system clock. In other words, if you are running the SX at 50 Mhz, then the RTCC can input a maximum external frequency of 25 MHz. And this maximum is also subject to the caveat that the external source must be a 50% duty cycle; an equal high/low duration.

    If the duty cycle is not 50%, then to the SX it will appear that the shortest duration (either high or low) is half the input freqency, and hence it will see an apparent higher frequency. To further explain this, let me cite an example. At 50 Mhz, the period of one cycle is 20 nano seconds; 10 nano seconds high, and 10 nano seconds low. This is if it has a 50 % duty cycle. On the other hand, if the waveform were 9 nano seconds high and 11 nano seconds low, the period would still be a total of 20 nano seconds, hence 50 MHz, but the duty cycle would be 9/20, being 45%. In this case the SX would "see" the shorter of the durations, 9 nano seconds as one part of the waveform, and would "think" a whole cycle of that to be 2x9 = 18 nano seconds, or 55.55 MHz, and that is higher than its clock frequency, so it will not count correctly. This would be the case whether the 9 naoseconds were the high part, or the low part. In other words 9/20 = 45% or 11/20 = 55%. In order to be able to read at the maximum RTCC input frequency, and that is half of the processor clock frequency, then the input duty cycle is required to be 50%.

    At slower input frequencies this duty cycle rule can be relaxed, to the extent as calculated by the "apparent" frequency approach explained above. So as long as the shortest duration, high or low, is not shorter than the half the duration of one processor clock period, then the RTCC input can be faithfully counted.

    There is another caveat on this, and that is that an external RTCC input would usually be asynchronous to the processor's clock, and hence the certainty of the processor "seeing" an input frequency of half its own clock is not guaranteed. So the actual RTCC input frequency of a 50% duty cycle that can reliably be detected by the processor is a little less than half the processor's clock frequency.

    The documentation of the SX48/52 states that "input syncing is always enabled on the RTCC input" leads one to understand why the "half clock frequency" rule exists. Eventhough the SX28 documentation does not make the same reference, by experimentation results I believe the same to be true for it.

    So, the long and the short of it is that you can't count 75 Mhz into an SX...... the best you can hope for is 37.5 MHz with a 75 MHz clock, and 50 MHz with a 100 Mhz clock. Both of these I have verified on an SX 28 running at room temperature with a 5 Volt supply.

    Hope this helps clear some things up.

    Cheers,

    Peter (pjv)

    Post Edited (pjv) : 3/27/2006 7:11:15 PM GMT
Sign In or Register to comment.