REMOTE PROGRAMMING
4-16
char cmd[25];
sprintf (cmd, "UNT UNL MLA TALK %d", address); /
*
make the talk command string
*
/
transmit (&status, cmd);
/
*
send the talk command string
*
/
StatCheck (address);
/
*
check interface status
*
/
}
/
*
*********************************************************************
*
/
void TxGpib (int address,char
*
command)
/
*
transmit command to address
*
/
{
char t_string[150];
int result;
result = sprintf (t_string, "UNT UNL MTA LISTEN %d DATA '%s' END", address, command);
transmit (&status, t_string);
/
*
can also use the send () function in the CEC
library
*
/
StatCheck (address);
}
/
*
*********************************************************************
*
/
void GetGpib (int address)
/
*
get an answer from device at address
*
/
{
char r_string[40], temp[80];
sprintf (r_string, "UNT UNL MLA TALK %d", address);
transmit (&status, r_string);
/
*
make device a talker
*
/
StatCheck (address);
/
*
check status for ok
*
/
strcpy (temp, " ");
/
*
init answer string to null
*
/
receive (&status, &length, temp);
/
*
receive answer
*
/
StatCheck (address);
/
*
check status for ok
*
/
strcpy (recv, temp);
/
*
copy receive string to global strinb recv[]
*
/
}
/
*
********************************************************************
*
/
void StatCheck (int address)
/
*
check the gpib status and exit if error
*
/
{
if (status != 0 && status != 32)
{ printf ("Error at device %d : status = %d",address,status); exit (0); }
}
/
*
********************************************************************
*
/