C# adc-11/12 need help, fast.

Post your .Net discussions here
Post Reply
victor.barna
Newbie
Posts: 1
Joined: Fri Jan 11, 2008 7:02 pm

C# adc-11/12 need help, fast.

Post by victor.barna » Fri Jan 11, 2008 7:19 pm

hi,i'm writing a program in C# using interop and the adc1132.dll:

port = 101;
product = 111;
long opened=0;
opened= adc11_open_unit(port, product);

if (opened!=0) {


adc11_set_trigger(1, 1, 1000, 10, 0, 512, 0);
adc11_set_interval(1000000, 100, channels, 2);
adc11_run(100, 0);
adc11_get_times_and_values(times[0], values[0], 100);


}

this just pops up a nice little messagebox that says "unable to lock unknown global file: ./adc11usb.c line 1080".

the adc11_get_value method works just fine, i don't know what's wrong.
please help!

picojohn
Advanced User
Advanced User
Posts: 382
Joined: Mon Jun 11, 2007 1:10 pm

Post by picojohn » Tue Jan 15, 2008 4:00 pm

Hello Victor,

Are you using a Parallel or USB ADC-11 or, a Parallel ADC-11 with USB/Parallel adapter?

regards
John

gruntman
Advanced User
Advanced User
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Post by gruntman » Fri Jan 25, 2008 6:22 pm

Victor,

Since you are using the USB ADC-11 I would recommend using the usbadc11.dll driver for your program. This will resolve the error you are getting. The functions are slightly different but are designed specifically for the USB ADC-11.

On your adc11_set_trigger you have the handle defined as 1, you will need to change this to the variable opened or you will run into issues down the line. I would recommend using the following function:
UsbAdc11SetTrigger (opened, TRUE, TRUE, 1000, 10, FALSE, 512, 0);

On adc11_set_interval you have the channels portion to the variable channels but in the code you posted you don't define this. You can define it something roughly like this:
short channels [] = {1, 3};
I would recommend using:
UsbAdc11SetInterval (opened, 1000000, 100, channels, 2);

Next you have the unit running then you go immediately into getting values. Between this you need to call UsbAdc11Ready (opened) until it returns true then you can call to get the values.

When you call to get the times and values call the following function: UsbAdc11GetTimesAndValues (opened, times, values, 100);
Times and values will need to be defined as an array.

A good idea is to look at the USBADC11CON.C.
While this isn't in C# like you are needing it will give you the right calls to make and all you will have to do is make it C# compatible.

Regards,

Richard Boyd
Technical Specialist
http://www.pc-oscilloscopes.com

Post Reply