2-13
Sample Programs
Sample C Programs
The *RST command is a common command that resets the analyzer to a known default config-
uration. Using this command ensures that the analyzer is in a known state before you config-
ure it. *RST ensures very consistent and repeatable results. Without *RST, a program may run
one time, but it may give different results in following runs if the analyzer is configured differ-
ently. For example, if the trigger mode is normally set to edge, the program may function
properly. But, if someone puts the analyzer in the advanced TV trigger mode from the front
panel, the program may read measurement results that are totally incorrect. So, *RST defaults
the scope to a set configuration so that the program can proceed from the same state each
time. The *CLS command clears the status registers and the output queue. AUToscale finds and
displays all signals that are attached to the analyzer. You should program the analyzer’s time
base, channel, and trigger for the specific measurement to be made, as you would do from the
front panel, and use whatever other commands are needed to configure the analyzer for the
desired measurement.
Setting Up a Service Request
The following code segment shows how to generate a service request. The following function
is demonstrated in the “gen_srq.c” sample program.
/*
* Function name: setup_SRQ
* Parameters: none
* Return value: none
* Description: This routine initializes the device to generate Service Requests. It
* sets the Service Request Enable Register Event Status Bit and the Standard
* Event Status Enable Register to allow SRQs on Command, Execution, Device
* Dependent, or Query errors.
*/
void setup_SRQ ( )
{
/* Enable Service Request Enable Register - Event Status Bit */
write_IO ("*SRE 32"); /* Enable Standard Event Status Enable Register */
/* enable Command Error - bit 5 - value 32 */
/* Query Error - bit 2 - value 4 */
write_IO ("*ESE 36");
} /* end setup_SRQ ( ) */