12-13-2013 08:22 AM
I am using the IVI-C driver for the N6700 power supply (http://sine.ni.com/apps/utf8/niid_web_display.model_page?p_model_id=7695). I am using LabWindows / CVI to create a DLL and TestStand to controll it. I have successfully used this driver to intialize, power up, readback values, power down, and close. However, I am having an intermittent problem revolving around the error "Unknown channel or repeated capability name." It occurs randomly on any function call.
I attached some of the files I'm using for reference.
Any Ideas?
Solved! Go to Solution.
12-16-2013 03:17 PM
BB102613,
This seems to be a naming issue. Review this posting that seems to be similar to your issue. Let me know how it pans out.
12-17-2013 06:55 AM - edited 12-17-2013 07:01 AM
That's kind of the conclusion that I came to as well. When I hardcode, in CVI, a "1" or "2" or "3" or "4" as the channel name into my function call, this error doesn't seem to occur. However, when i try to pass in a value from TestStand, where it is a variable in CVI, i get the problem intermittently. Here's how I set up the variable in CVI...
ViChar slotName[1] = "0";
slotName[0] = slotName[0] + slotNumber;
where slotName[] is passed as the channel number,and slotNumber is an int passed from teststand. I then pass the entire array, slotName, as the variable to the function. Performing it this way I get an intermittent error. Is there a better way to do this?
12-17-2013 07:16 AM
I'm not sure what is happening when you add a char and an integer ( "0" + 1 for example). The mixing of data types could be your problem. All you really need to do is format your integer into a character and pass that down.
12-17-2013 07:53 AM
What i think happens, in CVI, is that it converts the char into an integer, adds one and converts back to a char. So in decimal, "1" = 49, "2" = 50. That's how i came up with what i did there.
The problem with formatting an integer into a char is the function isn't looking for a char, it's looking for an array of chars... i.e. a poor mans string.
I have tried a couple diffferent solutions but i have been getting no luck as far as converting the integer into the string. One method i performed that I still think should work is the following
ViChar *slotName[1];
Fmt(slotName, "%d", slotNumber);
But this doesn't work either, it gives me an error stating that it's looking for a ViConstString. This makes me think that I can't pass this parameter in as a variable, the "const" part screams constant only. So my work around is just going to be to make a case statement that looks at the int slotNumber, and then hardcodes the "1", "2", "3", or "4".
Thanks for the help.
12-17-2013 09:38 AM
@BB102613 wrote:
What i think happens, in CVI, is that it converts the char into an integer, adds one and converts back to a char. So in decimal, "1" = 49, "2" = 50. That's how i came up with what i did there.
The problem with formatting an integer into a char is the function isn't looking for a char, it's looking for an array of chars... i.e. a poor mans string.
I have tried a couple diffferent solutions but i have been getting no luck as far as converting the integer into the string. One method i performed that I still think should work is the following
ViChar *slotName[1];
Fmt(slotName, "%d", slotNumber);
But this doesn't work either, it gives me an error stating that it's looking for a ViConstString. This makes me think that I can't pass this parameter in as a variable, the "const" part screams constant only. So my work around is just going to be to make a case statement that looks at the int slotNumber, and then hardcodes the "1", "2", "3", or "4".
Thanks for the help.
Or a very simple way is to add 0x30 (48) to the integer and cast that as a char. Instant ASCII conversion.
ViChar *slotName[1];
slotName[0] = char(slotNumber + 0x30);