View Full Version : Jaws dropping

08-29-2007, 05:22 AM

I had a real tough measurement task. Counting falling edges. With more than 20, but less than 100 nanoseconds t_fall. Tough, first, comparators fast enough are hard to find. At least if you are limited to a +5 V and 3.3 V supply. Second, because not many processors can handle that kind of temporal resolution.

The Propeller did it. Of course.

I am using two biased inputs so that one has +8 V threshold and one has +2 V threshold. I then use the /A&B mode for counter A in a separate cog. Since the /A&B is valid also for rising edges, I prequalify by looping until the signal gets above A pin (+8 V) and then I loop until the signal is below +2 V. Then, I read the counter contents and check to see if it is between 2 and 8, which is 25 and 100 nanoseconds (at 80 MHz).

If the edge is within those limits, I increase a counter in hub ram and after 1 second, I can output the result to the display. I had to meet a 10 000 edges/second specification. I had no problem doing 100 times better in assembler.

I have done this before. But then using a lot of hardware. All HW needed now is a simple R2R D/A and a series resistor. It can't get any better. There were quite a lot of dropped yaws when I presented the solution in a meeting only a few days ago.

You can't help it. The Prop: I'm loving it!


Post Edited (Skogsgurra) : 8/29/2007 9:19:31 PM GMT

Mike Green
08-29-2007, 05:49 AM
Just for curiosity, what was the R2R D/A for? Did you do the +8V threshold detection with a simple voltage divider or what? Likewise, did you do the +2V threshold detection also with a voltage divider (since the actual threshold is something like 1.6V). Nice solution and the Propeller is hardly working! Simultaneous video gaming anyone?

08-29-2007, 04:00 PM
Yes, I used the R2R as a D/A to bias the input*. The nice thing with an R2R is that it has a constant and pure resistive Ri. Add a resistor and take advantage of the very constant Vth of the Prop (1.43 +/-.05 V in all my chips) to set any threshold voltage between -30 and +30 V, other ranges possible, of course. Use the /A&B counter mode for falling edges from positive and the A&/B for rising edges from negative towards zero.

I could have used the PWM for reference voltage, but I have to filter rather hard to have a quiet reference voltage and that would have slowed down the measurement (measuring across a wide range of voltages in short time).

*The P7..P0 and Vss are layed out so that a standard SIL R2R can be dropped right into the holes on the ProtoBoard. There is even an empty hole for the output pin! Same for P15..P8 and P23..P16. Perfect if you want to build a three-phase "funny-waveform" generator. I may do that some day. And connect it to an NFO Sinus power stage. That will result in an arbitrary wave-form generator with up to 22 kW output at 400 V and very flexible phasing, distortion, unbalance, DC component, transients, drop-outs, sags and swells or whatever you may need for power testing.

Edit: Changed DIL to SIL


Post Edited (Skogsgurra) : 8/29/2007 6:02:36 PM GMT

Graham Stabler
08-29-2007, 05:50 PM
Nice solution


p.s. I think you mean jaws

08-29-2007, 06:16 PM
Yes. Of course. Swedes aren't that good at speling http://forums.parallax.com/images/smilies/wink.gif


Fred Hawkins
08-30-2007, 12:46 AM
What's a "standard DIL R2R"?

08-30-2007, 01:13 AM
It's all the resistors you need for an R-2R network packaged into a DIL pack - not really expensive and the tollerance is much better than with discrete resistors.