How many Interrupts per sec?

How many Interrupts do you think can be processed per second in managed code?

From my quick and dirty test i can only get 5 per second :frowning:

But in saying that i have my board driving PWM, reading Interrupt’s and writing to SPI… so still a good result :slight_smile:

In the past I have done tests on interrupt performance, and I have seen 1500-1700 interrupts per second. I did these tests on an EMX and USBizi.

In these tests, I had a PWM signal input to a InterruptPort, and did nothing in the interrupt handler, so I was measuring best case.

Five per second just sound way wrong. Of course, everything depends upon what you do in the interrupt handler.

What were you measuring? Rotation?

@ Mike - Yeah 5 to me sounds way wrong as well…

What were you measuring? Rotation?

The disc has a thin slot cut in it with a Sharp IR detector.
I am going to make the slot wider and see if that makes a difference…

I would check it out by manually rotating the disc and seeing if all the rotations are being recognized.

Could you be saturating the detector and suffering with poor recovery times?

Have done my hand and yes they are being recognised.

Data sheet says IO frequency of 0.3 MHz

post the code?

Nothing exotic…

            _beam = new InterruptPort(GHI.Premium.Hardware.G120.Pin.P2_13, true, Port.ResistorMode.PullUp, Port.InterruptMode.InterruptEdgeBoth);
            _beam.OnInterrupt += new NativeEventHandler(_beam_OnInterrupt);

void _beam_OnInterrupt(uint data1, uint data2, DateTime time)

 void timer_Tick(GT.Timer timer)
       index = 0;

First, I would only do one edge interrupt, which would half the interrupt rate.

I don’t see the initialization of the timer. I assume the interval is one second?

You have a pullup resistor set. Is this necessary?

I did have one edge originally…
Yes the timer is 1 sec.
Not necessary, will try without - out of curiosity why would that make a difference?

I was thinking that the pullup was too strong for the detector?