If your using the HT9170 like in the PDF you linked to, you'll want to connect them something like:
HT9170 Netduino ======== ========== Pin 11 D6 Pin 12 D7 Pin 13 D8 Pin 14 D9
public class DTFM : IDisposable { private Thread ListenThread; private bool Listening; private int LastValue; private InputPort Binary1; private InputPort Binary2; private InputPort Binary4; private InputPort Binary8; public delegate void OutputHandler(object sender, int value); public event OutputHandler Output; public DTFM(Cpu.Pin Binary1, Cpu.Pin Binary2, Cpu.Pin Binary4, Cpu.Pin Binary8) { // Initialize the local InputPort's utilized by the DTFM this.Binary1 = new InputPort(Binary1, false, Port.ResistorMode.Disabled); this.Binary2 = new InputPort(Binary1, false, Port.ResistorMode.Disabled); this.Binary4 = new InputPort(Binary1, false, Port.ResistorMode.Disabled); this.Binary8 = new InputPort(Binary1, false, Port.ResistorMode.Disabled); // Initialize the listener thread Listening = true; ListenThread = new Thread(new ThreadStart(Listen)); ListenThread.Start(); } public void Dispose() { // Make the thread expire Listening = false; Thread.Sleep(10); // Force the thread dead just in case if (ListenThread.IsAlive) ListenThread.Abort(); // Free the InputPort's Binary1.Dispose(); Binary2.Dispose(); Binary4.Dispose(); Binary8.Dispose(); } void Listen() { while (Listening) { // Don't execute if nothing is attached to the event if (Output != null) { int CurrentValue = 0; // Build the current value from the DTFM if (Binary1.Read()) CurrentValue += 1; if (Binary2.Read()) CurrentValue += 2; if (Binary4.Read()) CurrentValue += 4; if (Binary8.Read()) CurrentValue += 8; // If the value has changed, throw a new event if (CurrentValue != LastValue) { LastValue = CurrentValue; Output(this, CurrentValue); } } // Wait Thread.Sleep(100); } } }
Note: 10 = '0'; 11 = '*'; 12 = '#'