32
Using the HP E1459A Module
Digital Input
The HP E1459A is capable of simple digital inputs on any of the individual
four ports or combined Ports 0 and 1 or Ports 2 and 3. The
MEASure
command subsystem (see Chapter 3 for details) provides two commands for
reading the current value of the input ports:
MEASure:DIGital:DATAn:
type
:VALue?
— reads the current port value
MEASure:DIGital:DATAn:
type
:BIT
m
?
— reads an individual bit value
Example 2:
Digital Input
This program reads Port 0 as an individual 16-bit port and then it reads the
combined Ports 2 and 3 as a 32-bit port. The values returned are a signed
16-bit integer for Port 0 and a signed 32-bit integer for combined Ports 2 and
3. Although this program does not decode the returned value to determine
individual bit/channel values, a "0" in any bit position indicates the input to
the corresponding channel is low; a "1" in any bit position indicates the
input to the corresponding channel is high.
/* Digital Input Example
This program reads the current value of Port 0 (16-bit word)
and combined value of Ports 2 and 3 (32-bit word)
Created in Microsoft Visual C++ */
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
#define INSTR_ADDR "GPIB0::9::3::INSTR"
/* HP E1459A logical address */
int main()
{
ViStatus errStatus;
/* status from VISA call */
ViSession viRM;
/* Resource Mgr. session */
ViSession E1459;
/* session for HP E1459A */
int val;
/* value of Port 0 */
long val1;
/*Value of Ports 2 & 3 */
/*
Open a default Resource Manager
*/
errStatus = viOpenDefaultRM (&viRM);
if (VI_SUCCESS > errStatus){
printf("ERROR: viOpen() returned 0x%x\n",errStatus);
return errStatus;}
/*
Open the Instrument Session
*/
errStatus = viOpen (viRM, INSTR_ADDR,VI_NULL,VI_NULL, &E1459);
if (VI_SUCCESS > errStatus){
printf("ERROR: viOpen() returned 0x%x\n",errStatus);
return errStatus;}
/*
Query Port 0 as a 16-bit word
*/
errStatus = viQueryf(E1459, "MEAS:DIG:DATA0:WORD:VAL?\n","%t", val);
if (VI_SUCCESS > errStatus){
printf("ERROR: viQueryf() returned 0x%x\n",errStatus);
return errStatus;}
printf("Value returned %i\n",val);
Summary of Contents for E1459A
Page 4: ...4 Contents ...
Page 8: ...8 Notes ...
Page 10: ......
Page 28: ...28 Installing and Configuring the HP E1459A ...
Page 61: ...HP E1459A SCPI Command Reference 61 Figure 3 1 HP E1459A Status System Register Diagram ...
Page 72: ...72 HP E1459A SCPI Command Reference ...
Page 74: ...74 HP E1459A Specifications ...
Page 103: ...HP E1459A Register Definitions 103 1970 END ...
Page 104: ...104 HP E1459A Register Definitions ...
Page 106: ...106 Error Messages ...
Page 110: ...110 Index ...