error with set_interval

 
Post new topic   Reply to topic    Pico Technology Forum Index -> PicoLog
Author Message
Guest






PostPosted: Sat Jan 26, 2008 1:59 pm    Post subject: error with set_interval Reply with quote

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?
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 586
Location: St Neots

PostPosted: Mon Feb 11, 2008 12:40 pm    Post subject: Reply with quote

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
Back to top
Guest






PostPosted: Mon Feb 18, 2008 8:39 am    Post subject: solved Reply with quote

Hı and thanks for your help.
It's ok.
thanks again
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> PicoLog
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group