
66
Agilent VISA User’s Guide
3
Programming with VISA
void main(){
ViSession defaultRM,vi;
ViEventType eventType;
ViEvent eventVi;
ViStatus err;
ViInt16 trigId;
/* open session to VXI device */
viOpenDefaultRM(&defaultRM);
viOpen(defaultRM, "VXI0::24::INSTR", VI_NULL,
VI_NULL, &vi);
/* select trigger line TTL0 */
viSetAttribute(vi, VI_ATTR_TRIG_ID,
VI_TRIG_TTL0);
/* enable the event */
viEnableEvent(vi, VI_EVENT_TRIG, VI_QUEUE,
VI_NULL);
/* fire trigger line, twice */
viAssertTrigger(vi, VI_TRIG_PROT_SYNC);
viAssertTrigger(vi, VI_TRIG_PROT_SYNC);
/* Wait for the event to occur */
err=viWaitOnEvent(vi, VI_EVENT_TRIG, 10000,
&eventType, &eventVi);
if(err==VI_ERROR_TMO){
printf("Timeout Occurred! Event not
received.\n");
return;
}
/* print the event information */
printf("Trigger Event Occurred!\n");
printf("...Original Device Session = %ld\n",
vi);
/* get trigger that fired */
viGetAttribute(eventVi, VI_ATTR_RECV_TRIG_ID,
&trigId);
printf("Trigger that fired: ");
switch(trigId){
case VI_TRIG_TTL0:
Содержание E2094S
Страница 6: ...6 Agilent VISA User s Guide ...
Страница 116: ...116 Agilent VISA User s Guide 4 Programming via GPIB and VXI ...
Страница 126: ...126 Agilent VISA User s Guide 5 Programming via LAN ...
Страница 143: ...Glossary Agilent VISA User s Guide 143 Windows notification area See notification area ...
Страница 144: ...144 Agilent VISA User s Guide Glossary ...