I am having an issue using the axCWDIO library in my project to control a DAQPad-6508.Can anyone help?
I have an axCWDIO object on my form, have the properties set for output ports, and included the libraries axCWDAQControlsLib, CWDAQControlsLib, and CWUIControlsLib.
The problem is when I want to set specific lines to high (5v) it doesnt always set them.Havent been able to find anything in the documentation that comes with the NIDAQ (I used version 7.4.1) I dont know if this is really trying to write to a port instead of a line, perhaps thats my problem? Not only does it not set anything for some values of intcnt, it gives an error if I get too high (as if the highest is port.item(11) because there are 12 ports on a 96 bit version?) I also get an error reading after the first time.
Heres the basics of my code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using AxCWDAQControlsLib;
using CWDAQControlsLib;
namespace NIDaqTester
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
int ret = 0;
object data = null;
try
{
for (int intcnt = 0; intcnt < 11; intcnt++)
{
ret = axCWDIO1.Ports.Item(intcnt).SingleWrite(5);
Thread.Sleep(50);
ret = axCWDIO1.Ports.Item(intcnt).SingleRead(ref data);
Thread.Sleep(50);
}
for (int intcnt = 0; intcnt < 11; intcnt++)
{
}
for (int intcnt = 5; intcnt < 11; intcnt++)
{
ret = axCWDIO1.Ports.Item(intcnt).SingleWrite(0);
}
axCWDIO1.Dispose();
}
catch(Exception ex)
{
axCWDIO1.Dispose();
return;
}
}
}
}