Main Site Documentation

Question about IO66 of EMX


#1

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?


#2

@ 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


#3

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
            }

#4

@ leforban -

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