Example 3: Edge Interrupt - Keysight E1459A User & Scpi Programming Manual

64-channel isolated input interrupt module
Table of Contents

Advertisement

Edge Detected Event Detection

Example 3: Edge Interrupt

This example repeatedly polls the Port 0 Port Summary Edge Detection Register
to determine when an edge event occurs. When an event occurs, the program
reads the values of the Positive and Negative Edge Registers and returns the
values. The values returned are in the range of -32768 to +32767. Although this
program does not decode this returned value to determine individual bit/channel
values, a "0" in any bit position indicates an edge event was not detected for the
corresponding channel; a "1" in any bit position indicates an edge event was
detected for the corresponding channel.
/* Edge Interrupt Example
Created in Microsoft Visual C++
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
#define INSTR_ADDR "GPIB0::9::3::INSTR"
/* E1459A logical address */
int main()
{
ViStatus errStatus;
/* status from VISA call */
ViSession viRM;
/* Resource Mgr. session */
ViSession E1459;
/* session for Keysight E1459A */
int val, event;
/* Open a default Resource Manager */
errStatus = viOpenDefaultRM (&viRM);
/* Open the Instrument Session */
errStatus = viOpen (viRM, INSTR_ADDR,VI_NULL,VI_NULL, &E1459);
/* Unmask the negative edge events for Port 0 */
errStatus = viPrintf (E1459, "EVEN:PORT0:NEDG:ENAB 0xFFFF\n");
Keysight E1459A/Z2404B User and SCPI Programming Guide
This program sets both positive and negative edge detection,
queries the Port Summary Edge Detection Register in a loop
until an event occurs. The program then read the PEDGE and NEDGE
registers and returns the current value.
if (VI_SUCCESS > errStatus){
printf("ERROR: viOpen() returned 0x%x\n",errStatus);
return errStatus;}
if (VI_SUCCESS > errStatus){
printf("ERROR: viOpen() returned 0x%x\n",errStatus);
return errStatus;}
Using the Keysight E1459A Module
*/
37

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z2404a

Table of Contents