IO60P16 : always read true (or false) depending on the driver... but not change depending on the input voltage

hi everybody,

i’m facing a new problem, this time with the IO60P16 module.

i’m trying to read inputs.

the input electrical signal sent to the port Port1_Pin0 is around 3V and is provided by another power supply. GNDs are connecteds.
i have a physical button, a pull-down resistor. if pressed, 3V, if not 0V. i can check this voltage with a multimeter and at this level, it seems to be ok.

i’ve tried GHI driver :

var input = new IO60P16.InputPort(IO60P16.IOPin.Port1_Pin0, IO60P16.ResistorMode.ResistivePullDown); 

or IanLee driver


io60p16 = new GTM.IanLee.IO60P16.IO60P16Module(4);

var input = io60p16.CreateInputPort(IOPin.Port1_Pin0);
input.Resistor = ResistorMode.ResistivePullDown;
input.Read();

next, i simply use a timer to read values :


var t2 = new GT.Timer(1000);
            t2.Tick += timer =>
                           {
                                                             Debug.Print("readed value:  " + input.Read().ToString());
                           }
            t2.Start();
            return;

with GHI driver, i always read false. and with IanLee’s driver i always read true… pushing my button or not does not change anything…

i’m obviously doing something wrong, but what ??

Try the same on port 0. I bet you get different results with the GHI driver. That problem should be fixed in my latest version and is coming to the GHI driver in the next SDK release. Have you pulled the latest code from my repo since last week?

1 Like

i’ve downloaded your driver on 2013-01-12, but on morning… i’m retrying with your last release !

@ iannLee74 : your latest driver works ! but i have made few modifications and i have a new version of your driver to propose to you.

I use the same delegate for the 2 events in the port or in the module class :



public abstract class Port : IDisposable
    {
        public event IO60P16Module.InterruptEventHandler OnInterrupt;

i’ve added to your class InterruptEventArgs the value of the port that raises the event (and i leave only IOPin instead of port and pin)


public class InterruptEventArgs : EventArgs
    {
        public InterruptEventArgs(IOPin pin, bool pValue, DateTime timestamp)
        {            
            Pin = pin;
            Timestamp = timestamp;
            this.Value = pValue;
        }
        
            public IOPin Pin { get; private set; }

            public bool Value { get; private set; }

             public DateTime Timestamp { get; private set; }
    }

i’ve also removed some duplicate code around GetPortNumber and GetPinNumber methods.

tell-me if you’re interested.

Of course I’m interested! Those functions are so small I’m curious to see what you came up with :slight_smile: I’ll take a closer look at all of this later when I get home and integrate it into the source. Thanks!

@ sensei I worked in your changes and did a lot of refactoring tonight including adding ResistorMode & InterruptMode options when creating an InterruptPort. Now you can use the InterruptMode argument to eliminate the double interrupts that were firing on both edges before. It’s still possible to get double interrupts but that’s due to glitch/debounce. The chip doesn’t have a native glitch filter but I’ll probably add one via debounce logic in my next revision. Also, I haven’t tested the ResistorMode changes yet. Let me know if you find anything not working there. Enjoy!

@ ian : how can i send the zip file to you ?

Send it to ian at house of lees dot net.