Question about IO66 of EMX

I have tried the define as follow:


OutputPort SCK1   = new OutputPort(EMX.Pin.IO66, true);

but there is Exception.

How can I use use the IO66 of EMX as General purpose digital I/O?

@ andre.m -

my test code:



namespace FEZ_Cobra_Workhard
{
    public class Program
    {


        public static void Main()
        {


            OutputPort SCK1   = new OutputPort(EMX.Pin.IO66, true);



            while (true)
            {
                // Sleep for 500 milliseconds
                Thread.Sleep(500);
            }



        }
    }

}

After “F5”, in Output window:


.................................................
......................................................
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Users\Tobi\Documents\Visual Studio 2010\Projects\ECOLINE_Project_Board - Digitalout-Test\FezCobraWorkhard\bin\Debug\le\FezCobraWorkhard.exe', Symbols loaded.
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Net.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Hardware.dll'
'Microsoft.SPOT.Debugger.CorDebug.dll' (Managed): Loaded 'C:\Program Files\GHI Electronics\GHI Premium NETMF v4.2 SDK\Assemblies\le\GHI.Premium.Hardware.EMX.dll'
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
    #### Exception System.Exception - CLR_E_PIN_UNAVAILABLE (1) ####
    #### Message: 
    #### Microsoft.SPOT.Hardware.Port::.ctor [IP: 0000] ####
    #### Microsoft.SPOT.Hardware.OutputPort::.ctor [IP: 0006] ####
    #### FEZ_Cobra_Workhard.Program::Main [IP: 0007] ####
A first chance exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll

IO66 is reserved for the TFT display. If you want to use it you need to change the config:

 bool cfg_chg = Configuration.LCD.Set(Configuration.LCD.HeadlessConfig);
            // to use the LCD reserved IOs, return true if config has changed false otherwise.
            if(cfg_chg)
            {
             
PowerState.RebootDevice(false); //hard reboot
            }
1 Like

@ leforban -

It works well now!! thank you very much!!