INST_ONSRQ()
NAME
INST_ONSRQ − Compiled SCPI Commands
SYNOPSIS
INST_ONSRQ (id, c_function);
DESCRIPTION
This is an HP Compiled SCPI macro command. The instrument on service request command installs the function specified by the c_function parameter as a handler to be called when the instrument specified by id asserts a service request.
PARAMETERS
id
The user variable name for the instrument. This is the variable name that you assign to the instrument in the INST_DECL or INST_EXTERN command. For example,
INST_DECL (vm, "E1411B", REGISTER);
assigns vm as an instrument data pointer to the E1411B. Now when you use vm as the id in INST_ONSRQ, a user routine is called when the HP E1411B requests service.
c_function
The C function that is called when a service request is asserted from the instrument defined by the id parameter. When writing your C function, you must include the INST_PARAM command so that you can pass the instrument id.
COMMENTS
To disable the service request, set the c_function parameter to 0. It is good practice to disable service request when entering a service routine. This avoids any confusion that would result by calling the service while already executing this routine.
Under some circumstances, an SRQ may be executed from an interrupt routine. If an SRQ function is called, it should not send commands to an instrument if the main program is using the same instrument. Also, some register-based instrument commands should not be executed from an SRQ function called from an interrupt routine. See the instrument’s C-SCPI manual page for information on when a register-based instrument causes an SRQ function to be called from an interrupt routine. See the HP SICL documentation for information on message-based devices.
The HP SICL iintron and iintroff functions can NOT be used for disabling and enabling the C-SCPI ONSRQ interrupts in REGISTER configurations. REGISTER configurations call the c-function specified in the INST_ONSRQ macro command. MESSAGE configurations, however, use the HP SICL interrupts and can be enabled or disabled using these SICL functions.
For MESSAGE configurations, C-SCPI uses the HP SICL ionsrq() function. See the HP SICL documentation for more information.
When writing your C function to be called with a service request, you must include the INST_PARAM command to pass the instrument id.
If you use INST_ONSRQ while in the overlapped mode, you can come across other problems where your controller may be doing other tasks rather than finishing up the instrument command. See "Using the Overlapped Mode" in the HP Compiled SCPI User’s Guide for additional information.
The INST_ONSRQ command cannot be executed before an INST_OPEN command.
See the *SRE command in the VXI instrument user’s manual.
EXAMPLE
This example defines the program to call service if the HP E1411B Multimeter asserts a service request.
INST_DECL (vm, "E1411B", REGISTER);
void service (INST_PARAM (id, "E1411B", REGISTER))
{
.
.
}
main ()
{
INST_STARTUP();
INST_OPEN (vm, "VXI,24");
INST_ONSRQ (vm, service);
.
}
— December 04, 1992