Main Site Documentation

Interrupt processing question


I am waiting for my hardware…

I want to be able to toggle changing bit patterns to an output port at about 400HZ.

The Timer class callbacks seem to use internal threads in the emulator, so it will not be possible to use it to drive the bit stream with minimal jitter.

The next approach that came to mind would be to output PWM on a pin and then take the output of that pin and connect it to another pin. On the second pin, set it for input interrupts on the rising edge.

My questions… Are interrupts dispatched through a thread, or do they go directly to the specified interrupt routine?

Is it possible to setup a clock which generates interrupt directly without external wiring?



FEZ is not real time, see FAQ. So, if you need to toogle a pin at a fixed speed then you need to use PWM.

Events come from an internal thread, again, not real time :wink:


Thanks for the reply.

I don’t need real-time.

I was trying to get an understand of how interrupts are handled. From what you said, the hardware interrupts are being translated in messages, which are put into a queue, and then dispatched to the user via a framework worker thread. The actually processing of the interrupt is not being done in the hardware ISR.

Is any priority being given to the worker thread that is relaying the interrupt?

I looked through the Microsoft documentation, but saw little information about the internals of the framework. Is the book by Jens Kuhner a good source of this type of information? I


You are correct about the description. I personally NETMF is an excellent piece of hardware but it is missing some documentation. This is why we created the beginner book…which only covers the very basics.

Jens’ book is very good but I do not think it explains what you are looking for. You sound like you have good knowledge of managed system and C# so maybe you should direct your question directly to Microsoft through their online groups.


I set up a PWM signal with the period of 2ms and have an interrupt pin monitoring its rising edge. It will then print out milliseconds on every interrupt.

The interval between two interrupts is 10 ms. I don’t know if this is fast enough for my project though…


Do not try and do a Debug.Print in an ISR. A Debug print is way too slow, just stash a small number of readings in an array and then print them out when done. Also, make sure to turn off the glitch filter on your interrupt input as it will mess with the response time.

This subject was covered in depth a week or two ago, a quick search of the forum might be helpful.


Over the next two days I’ll document my RC6 remote control receiver as a Domino project. The RC6 IR protocol is a good demo of what you can do with these devices, as the half-bit time (the minimal time that must be measured accurately) is less than half a millisecond (444us to be exact).

The Fez Domino does this with no sweat at all.

It’s a good (I think) demo of interrupt pin capabilities.



I have been waiting for this for a long time. Can’t wait to see your project


RC6 decoder, to demonstrate the use of timing a sequence of pulses to an interrupt pin, is posted at: