error with set_interval

Forum for discussing PicoLog
Post Reply
Guest

error with set_interval

Post by Guest »

hi,
I have a problem with adc11/10 using adc11_set_interval. I' writing my project with C#.NET (Visual Studio 2005).
I call this function but I see this error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I looked adc11con.c then thouht maybe my parameters were wrong. so that I sent the same parameters with adc11con.c. but the problem wasn't solved. here is my code

public static ulong BUFFER_SIZE= 1000; (Global variable)
ulong actual;
short[] channels = {1,3};
short no_of_channels = 2;
actual = myproject.dlldeclaration.adc11_set_interval(100000, BUFFER_SIZE, channels, no_of_channels);
Console.WriteLine(actual.ToString());

and this is function declaration in my dll class

[DllImport("adc1132.dll")]
public static extern uint adc11_set_interval(int us_for_block, ulong ideal_no_of_samples, short[] channels, short no_of_channels);

Is it about my Visual Studio Version?
Can anyone help me?

ziko
Advanced User
Advanced User
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Post by ziko »

Hi one of the software engineer has kindly had a look at your query and found the following

"The function declaration is incorrect:

DllImport("adc1132.dll")]

public static extern uint adc11_set_interval(int us_for_block, ulong ideal_no_of_samples, short[] channels, short no_of_channels);


ulong is a 64 bit word, the function takes a 32 bit word and therefore should actually be


DllImport("adc1132.dll")]

public static extern uint adc11_set_interval(uint us_for_block, uint ideal_no_of_samples, short[] channels, short no_of_channels);
"

Hope this helps

Kind regards
Ziko

Technical Specialist

Guest

solved

Post by Guest »

Hı and thanks for your help.
It's ok.
thanks again

Post Reply