ReadAllDigital / multiple VM140(K8061)

Dear everybody,

I have 2 problems, both concerning the VM140(K8061) interface-card:

The digital- and analog input are connected to pushbuttons leading to a 5 V supply. I had some problems, so I made a testprogram with C# to check whether the buttons work. But the ReadAllDigital doesn’t seem to work. I use Console.WriteLine to print out the value of the Digital input, but it doesn’t change if I press a button, it remains 255. I added my code below. What am I doing wrong?

The second problem is a bit strange. I use four K8061’s. While testing, I learned that one of the cards doesn’t work if more than 2 cards are connected. I use the jumpers to give the cards their adress, the C# program confirms that there are four cards connected with a MessageBox showing the cardadresses, but if I press one of the buttons linked to the input of that card, my test doesn’t response. But if I only connect that card, or that card and another one, it does response. What could be the problem?

Here is my code:
I use the FormLoad event to connect the cards like this:

private void Form1_Load(object sender, EventArgs e)
{
            CA[0] = OpenDevice();
            CA[1] = OpenDevice();
            CA[2] = OpenDevice();
            CA[3] = OpenDevice();
            MessageBox.Show(CA[0].ToString() + " " + CA[1].ToString() + " " + CA[2].ToString() + " " + CA[3].ToString());
            timer1.Enabled = true;
}

In the timer I read the digital and analog input:

  private void timer1_Tick(object sender, EventArgs e)
        {

            if (Connected(CA[0]) && Connected(CA[1]) && Connected(CA[2]) && Connected(CA[3]))
            {
                for (int j = 0; j < CA.Length; j++)
                {

                    int i = ReadAllDigital(CA[j]);
                    Console.WriteLine(i.ToString());
                    DigIn[0] = (i & 1) > 0;
                    DigIn[1] = (i & 2) > 0;
                    DigIn[2] = (i & 4) > 0;
                    DigIn[3] = (i & 8) > 0;
                    DigIn[4] = (i & 16) > 0;
                    DigIn[5] = (i & 32) > 0;
                    DigIn[6] = (i & 64) > 0;
                    DigIn[7] = (i & 128) > 0;

                    ReadAllAnalog(CA[j], AnaIn);


                    for (int k = 0; k < 8; k++)
	      {
		if (DigIn[k] == false)
                            {
                                     MessageBox.Show("DigIn Kaart: " + CA[j].ToString() + "; nummer: " + k.ToString()); 
                            }
	      }
                    for (int l = 0; l < 8; l++)
                    {
                            if (AnaIn[l] > 100)
                            {
                                     MessageBox.Show("AnaIn Kaart: " + CA[j].ToString() + "; nummer: " + l.ToString());
                            }
                    }
                    
                }
            }
            else
            {
                MessageBox.Show("Card disconnected");
            }  
        }       

Thanks in advance

[quote]The digital- and analog input are connected to pushbuttons leading to a 5 V supply.[/quote]All the digital inputs are connected to +5V via 10k pull-up resistors RA2.
To get the input low, you have to put the switches between the digital inputs and GND.

I’m sorry, don’t know the cause of the second problem.

Have you downloaded and installed the latest driver and the demo software for the K8061?
The package is:"[color=#0000FF]Complete software package edition 2011[/color]"
Downloads link: velleman.eu/support/download … 8061&type=

Just a question …
…in your timer tick routine in the line

what value does CA.Length return?