04-25-2007 11:41 AM
Hi
I have 2 problems that I need your assistance to solve them.
1) The first problem is related to SCXI-1166. I have PXI/SCXI combo (PXI-1052). The chassis holds the following cards PXI-2527, PXI-4071, PXI-6229, SCXI-1193 and SCXI-1166. The problem is that sometimes SCXI-1166 does not respond to the commands to set a switch. AT times, switches 0 to 15 work but 16 to 31 do not. Some other times nothing in this card works. The only way to solve this problem is to turn OFF the PXI chassis and ON again. This would solve the problem.
Here is my code,
// To initialize the card.
//NOTE, I use and array of to handles (hRelaySwit) because I am installing a second SCXI-1166 card.
error = niSwitch_InitWithTopology
("firstRelay_1166",NISWITCH_TOPOLOGY_1166_32_SPDT, VI_FALSE, VI_TRUE, &hRelaySwit[0]);
//******************************************************************************
// To set the relay
int setRelay(short relayCardNum, short relayNumber, BOOL state) {
int error = 1;
int relayControl = NISWITCH_VAL_OPEN_RELAY;
char relayName[10] = {0};
if((relayNumber >= 0) && (relayNumber <= 31))
{
sprintf(relayName, "k%hd", relayNumber);
if(state)
relayControl = NISWITCH_VAL_CLOSE_RELAY;
error = niSwitch_RelayControl (hRelaySwit[relayCardNum], relayName, relayControl);
if(!error)
{
error = niSwitch_WaitForDebounce (hRelaySwit[relayCardNum], 5000);
}
}
return error;
}
//******************************************************************************
//To close the card
if(hRelaySwit[0])
{
if((error2 = niSwitch_close(hRelaySwit[0])) != 0)
{
MessagePopup("ERROR", "COULD NOT CLOSE FIRST RELAY CARD SCXI-1166");
}
}
//******************************************************************************
2) My second problem is related to the frequency counter. (Agilent 53132A). If I stop in the middle of my program during debugging and restart again, the
program would complain that the device is not available. I would like to know if there is any GPIB command that would release all the handles in the beginning of my program or refer me to a tutorial or an example.
Problem #1 is very urgent and I would like your quick response.
Thanks for your help in advance.
Ismail
04-25-2007 12:20 PM
Hi Izzy123,
I'm sorry to read you are having a problem with your SCXI-1166. May I ask what signal levels your application is switching? In reference to your application, what is usually taking place when these failures occur?
Best regards,
Chad Erickson
Switch Product Support Engineer
NI - USA
04-25-2007 01:06 PM
Hi Chad,
Thanks for your quick response. The signal level is 3.0 Volts and the current levle could be up to 300 mA at the in-ruch time and goes down to 200 mA. I would like to mention that I am using multi-threading technique to test 8 units. However, I am closing one switch and open it before I close another switch. While we are on this topic of multithreading, do I have to have Critical sections around each call to the SCXI-1166?. Does this card handle several call in the same time?.
Please let me know if you need more infrmation.
Thanks,
04-25-2007 07:44 PM
04-25-2007 08:02 PM
04-26-2007 01:55 PM
Hi Izzy123,
Important change to my last post: The NI-SWITCH driver is threadsafe. Thus, you do not need to have critical sections around each call to the SCXI-1166.
While you may want to utilize critical sections to properly manage your code, my last response was erred in that you do not need to wrap the NI-SWITCH calls with critical sections.
I apologize for any misunderstanding!
Chad Erickson
Switch Product Support Engineer
NI - USA