Thanks so far to all the programmers in the house, most expecially Mr. Mark I tried all he gave me and they worked excellently well. I have a few questions to ask programmatically.
1)
using System.Runtime.InteropServices;
...
DllImport("usbadc11.dll")]
public static extern uint UsbAdc11GetValue(short handle, int channel, uint value);
...
short a =(short) UsbAdc11MaxValue();
uint value = 0;
UsbAdc11GetValue(a, 5,value );
richTextBox1.Text = value.ToString();
do you think I aways have to use the out keyword just like the way it was done to the declaration bellow when I'm expecting any value from my logger card? i got 62062593 which i felt it is not correct because when i divided by maximum count and multiply by 25000(mv) it did not give me a required voltage.
[DllImport("usbadc11.dll")]
public static extern BOOL UsbAdc11MaxValue(short handle, out ushort max);
2)
[DllImport("usbadc11.dll")]
public static extern long UsbAdc11SetInterval(short handle, long us_for_block,long halfburffer, short channels, short no_of_channel);
[DllImport("usbadc11.dll")]
public static extern short UsbAdc11Run(short handle, long no_of_values,short method);
int i;
long actual;
short[] channels ={ 1, 3 };
short no_of_channels = 2;
Console.WriteLine("Collect block immediate....\n");
Console.WriteLine(" press any key to start\n");
Console.ReadLine();
short opened = UsbAdc11OpenUnit();
g_handle = opened;
// trigger dis disabled
UsbAdc11SetTrigger(g_handle, FALE, FALE, 0, 1, FALE, 0, 0);
//actual is E-10^6
actual = UsbAdc11SetInterval(g_handle, 100000, 500000, channels[0], 1);
while (UsbAdc11Ready(g_handle) == 0)
{
AutoResetEvent autoEvent = new AutoResetEvent(false);
// autoEvent.WaitOne();
autoEvent.WaitOne(5000, false);
}
UsbAdc11GetTimesAndValues(opened, times , values, BUFFER_SIZE);
Console.WriteLine("\n ALL THE READINGS\n");
Console.WriteLine("\n(us)\tTimevalues\t");
foreach (int t in values)
{
Console.WriteLine("\n{0}}", times.Length);
}
its not giving me any value, it complains about the parameter signature ,sometimes about the memory corrupt value cannot be read a soon.
how can i go about this three function in short. any other way out please.
1) UsbAdc11Run
2) UsbAdc11GetTimesAndValues
3)UsbAdc11SetInterval
and if i still need to know UsbAdc11SetTrigger thanks
2) The error about the parameter signature being incorrect would suggest a problems with your declarations. I've only taken a quick look but it looks like you have used longs where you should have used ints (a managed long is 64s bit whereas a native long is 32 bits).