FEZ IR receiver with Sony Remote

Any suggestions for a C# routine to decode the 12 bit SIRC Pulse-width modulation code from a Sony Remote? It appears necessary to measure the Pulse width of pulses in the data stream coming from the IR Receiver with an C# equivalent to the BS2 RCTIME function.

Please try this and let us know if it worked for you.

Actually, this is one thing I was going to do but never got to it so maybe you can share the code. I have done IR remote decoding but not on FEZ.

By the way, Sony is not the easiest one to decode, NEC is easier I think. This is a very good website covering many protocols.

Looks really interesting project to port over from the Microdev SBC that uses a Meridian CPU. My question is that the heart of the reader is timing code. So I wonder what if any effect on the # ticks counted to determine 1200 and 600 usec pulse timing, to the difference in CPUs. His uses a Freescale i.MXS ARM920T at 100MHz vs the FEZ 72MHz NXP ARM. Would I have to scale the # ticks by the CPU speed?

You are programing in high level C# on NETMF so the hardware is transparent to you. Every NETMF system has a tick of 100ns.
This applies to everything not just the processor type/speed.

The code should just drop and work on FEZ but I think his project was made for NETMF 3,0 and now we are on NETMF 4.0 so you need to make new project then copy his sources to your project.

Rebuilding in .net 4.0 on Mini_FEZ, may I ask for assisatcne with the following error msg:

Best overloaded match for ‘Bansky.SPOT.IrDA.SonyReceiver.SonyReceiver(Microsoft.SPOT.Hardware.Cpu.Pin)’ has some invalid arguments and cannot convert from ‘GHIElectronics.NETMF.FEZ.FEZ_Pin.Digital’ to ‘Microsoft.SPOT.Hardware.Cpu.Pin’

// Main Program
public class Program
public static void Main()
TVRemoteReceiver sony = new SonyReceiver(FEZ_Pin.Digital.Di4);
sony.DataReceived += new TVRemote.TVRemoteDataHandler(sony_OnDataReceived);
while (true)

SonyReceiver.cs Resource
public class SonyReceiver : TVRemoteReceiver
/// Creates new Sony TV Remote Receiver instance
/// Infrared demodulator pin
public SonyReceiver(Cpu.Pin receiverPin)
this.ReceiverPin = receiverPin;
_irdaPort = new InputPort(ReceiverPin, false, Port.ResistorMode.PullUp);
_pulses = new long[DATA_LENGTH];

        // Start reading thread
        _runningThread = true;
        _mainThread = new Thread(new ThreadStart(DoWork));

Look at any of our driver code and you will find the fix :smiley:
It is also in the book many times

It is done by casting the types (forcing them)
Something like…
SonyReceiver( (Microsoft.SPOT.Hardware.Cpu.Pin) FEZ_Pin.Digital.Di4);

It is that easy!

Tnx it works! One last error is an apparent missing reference that defines “TVRemote” in Main(). There’s no instance of this in either of the reference .cs files and should there be?

Another question in the other “Button” program is the program is looking for InputManager that is in the MS.SPOT.Input namespace, but the file with that resource does not appear available in the .NET SDK in my PC to Add.

You download the complete project I am assuming to it should be there. If you have difficulties with the project then you will need to check with the person who made it.

About the button, Is this related to the same remote project? If not, do not start new question in the same thread please. Also, I do not know what you are asking for!

The the remote project made for old NETMF 3.0? If so there will be some needed code changes to make it work on 4.0. I hope the free ebook would be able to help you.