So I'm programming a DC Power Supply (Sorensen SGe30X167) and I have downloaded the IVI-C drivers from their website and created a driver session and logical name in NI MAX. I'm programming in C and have this line of code:
powerStatus = IviDCPwr_InitWithOptions("powersupply", VI_FALSE, VI_FALSE, "", &powerSession);
The status returned back is "0x80000000" and I'm not quite sure what that means and how to debug the issue.
Answer by RoaringDragon · Jan 16 at 09:03 PM
@Kirk Fertitta So I added the IviDCPwr_error_message function so my code is:
powerStatus = IviDCPwr_InitWithOptions("powersupply", VI_FALSE, VI_TRUE, "", &powerSession); IviDCPwr_error_message(powerSession, powerStatus, &powerError); printf("Status: %s\n", powerError);
The message that is printed is "Unknown status code."
I'm wondering if it could be from incorrectly initializing the driver in NI MAX?
Answer by Kirk Fertitta · Jan 16 at 09:08 PM
Yes, you have two independent bits of machinery at work here -- the NI class driver and the specific driver. I would first try to initialize the Sorensen driver directly. If that works, then it's probably in the NI MAX settings. If it doesn't work, then it's something in the specific driver and you can take an NI-Spy capture to see what the traffic is. Actually, you could fire up NI-Spy right now as you have it and see if it's even getting to the VISA I/O initialization. If it's not, then that would also indicate an NI MAX settings issue.
Also, just to rule out some other possibilities, you can pass in VI_FALSE for both of the InitWithOptions parameters (your first code snippet has it at false but your second has one of them set to true).