G120HDR - InputPort.OnInterrupt

Hello,
I have problems with OnInterrupt event. When I try to use this event, System.ArgumentException occurs in Microsoft.SPOT.Hardware.dll (4.3.1.0). Target Framework is 4.3, included GHI libraries are ver. 4.3.6.0. I have used pins P1.15 and P1.16. What is wrong? And general question: Which pins can be set as digital input/output? I can’t find this information anywhere.

Here is my code:


static InputPort sdCardPresentPort = new InputPort(GHI.Pins.G120.P1_16, false,
Port.ResistorMode.Disabled);
sdCardPresentPort.OnInterrupt += sdCardInterrupt_OnInterrupt; //here exception occurs
static void sdCardInterrupt_OnInterrupt(uint data1, uint data2, DateTime time)
{
     scCardThread.Start();
}

Thanks!

See table 3.1 for pin out info for the G120.

https://www.ghielectronics.com/downloads/man/G120_User_Manual.pdf

@ Adam - Ports 1 and 3 are not interrupt capable on the G120. Only ports 0 and 2 are interrupt capable.

The table that ianlee74 directed you to will indeed show which pins are GPIO capable.

If your Input Port is from


using Microsoft.SPOT.Hardware

and not a GHI type then you might need to use


static InterruptPort sdCardPresent

to get the interrupt to fire


sdCardPresent= new InterruptPort(STM32.Pin.PA1, true, Port.ResistorMode.Disabled, Port.InterruptMode.InterruptEdgeBoth);


void sdCardPresent_OnInterrupt(uint data1, uint data2, DateTime time)
{
   // Do stuff                
}

I know I did.

@ Jason - What you say may be true but if you use 1.0 ~ 1.31 or 3.0 ~ 3.31 on this system, they are not interrupt capable by processor manufacturer’s hardware design, regardless on how he accesses them.