Quantcast
Viewing all articles
Browse latest Browse all 5353

Unable to close device handle to NI USB 8452 using Python

Hi All,

 

I have a NI USB 8542 box and I am writing Python wrapper functions (using ctypes) to make calls to the NI USB 8452 I2C C API. I am making Python calls to the Ni845x.dll. I am on a Windows 10 laptop (64-bit) and I am using 64-bit Python 3.5.1. For the drivers I have Ni-845x drivers version 19.0

 

I am able to successfully find the NI USB 8452 by making a call to the "ni845xFindDevice()" function from my Python script. I am also able to successfully open the NI USB 8452 for access by making a call to "ni845xOpen()" function from my Python script. I save the device handle returned from the "ni845xOpen()" function call. I then pass this same device handle to the "ni845xClose()" C function via my Pyhton script. But the return value for the "ni845xClose()" function is "-301706" after passing this code through the "ni845xStatusToString()" function this is what I get: 

b'NI-845x: The device reference is invalid. Verify that the supplied device reference contains a valid device name.\n'

 

Can anyone please tell me why I am unable to pass a handle to the Close function that was generated by the Open function? 

 

Attached is the screenshot of the command terminal from where I am running my Python script. I have also attached my Python script

 


Viewing all articles
Browse latest Browse all 5353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>