02-06-2007 11:16 AM
//----------------------------------------------------------------------------------------
// Function: AttenConfig
// Description: Configures and opens a connection to the digial attenuator
// Paramaters:
// Returns: int 0 for success
//----------------------------------------------------------------------------------------
int __stdcall AttenConfig(int client, void *Data){
int status = 0;
//Get session
viOpenDefaultRM(&RmViSession);
//Open device
status = viOpen(RmViSession, "GPIB::10::INSTR", VI_NULL, VI_NULL, &AttenViSession);
if(status != 0){
fpUILog("...Weinschel 8310 Driver Open Device Error");
GeneralReturn(-1, client);
}else{
GeneralReturn(0, client);
}
return 0;
}
//----------------------------------------------------------------------------------------
// Function: AttenSet
// Description: Sets the attenuator
// Paramaters:
// Returns: int 0 for success
//----------------------------------------------------------------------------------------
int __stdcall AttenSet(int client, void *Data){
int *temp, status = 0;
char Command[10];
temp = Data;
memset(Command, '\0', 10);
strcpy(Command, "ATTN ");
Fmt(&Command[strlen(Command)], "%s<%i", *temp);
status = viWrite(AttenViSession, Command, sizeof(Command), VI_NULL);
if(status != 0){
fpUILog("...Weinschel 8310 Driver Set Atten Error");
GeneralReturn(-1, client);
}else{
GeneralReturn(0, client);
}
return 0;
}
02-06-2007 11:38 AM