Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

issues using SPI write and read with ni845x.dll in visual studio 2010

Reposting this in the software section:

I am trying to use the .dll supplied with the 8451 to communicate via SPI, and I have most functions (seemingly) working.  When I try to send a message, however, I get an error (-301710 - invalid configuration reference).  Some of the documentation for the dll is... lacking, but I tried passing the configuration handle by reference and value, both giving the same error. 

 

My code flow is as follows:

1. Find device with ni845xFindDevice

2. Open device with ni845xOpen

3. Open device configuration with ni845xSpiConfigurationOpen

4. Set all configuration parameters with their functions

5. Attempt to write data with ni845xSpiWriteRead

6. Close configuration with ni845xSpiConfigurationClose

 

It fails at step 5.  I've tried the method of passing variables, swtiched steps 2 and 3, switched steps 5 and 6, all to no avail. As a side note, I pass the configuration handle (by reference) to a subfunction that performs all of parts 3 and 4.  I am storing the device handles as ULong (which I grabbed from the .h file that was included) and this works for the other functions that require handles. 

 

Does anyone have advice on what to try next?

0 Kudos
Message 1 of 3
(5,865 Views)

Hello rwortman,

 

Could you please show us the configuration that you are using for this task?

 

0 Kudos
Message 2 of 3
(5,846 Views)

I'm using visual basic 2010:

 

Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
Microsoft .NET Framework
Version 4.0.30319 RTMRel

Installed Version: Professional

Microsoft Visual Basic 2010   01018-532-2002181-70210

And I installed the 8451 driver from ni.com:

NI-845x 2.1.2

0 Kudos
Message 3 of 3
(5,831 Views)