Main Site Documentation

Are Tristate Ports supported on FEZ?


I tried to use the TristatepPort but get InvalidOperation exception when Active property is set:

_port = new TristatePort((Cpu.Pin)GHIElectronics.NETMF.FEZ.FEZ_Pin.Digital.Di9, false, false, Port.ResistorMode.Disabled);
_port.Active = false; // this line throws exception

It looks like this problem was also discussed on GHI forums for Embedded Master:,1450.0.html

Is this supposed to work on FEZ?


Doesnt it need to be a interrupt capable port for tristate. I don’t believe di9 is interrupt capable.

Page 41 of the ebook they provide

Note: Due to internal design, TristatePort will only work with interrupt capable digital pins.


I tried this on FEZ Mini. Looking in the Broch_FEZ_Mini.pdf table on page 2 this port is interrupt capable. I also tried few other ports with same result.


Can we get a copy of the exception?


Tristate port only work on interrupt capable inputs. I think this is already pointed out in the ebook.


Try the example provided in ebook.
You will get an exception if the pin is input already and you set it to input again. Same for output.


That was exactly the problem. Thanks for your help.