
Register Descriptions
35
Program Example
The following sample program demonstrates how to write to and read from
registers on the Agilent E2259A. The program was developed with the
ANSI C language using the Agilent VISA extensions. The program was
written and tested in Microsoft Visual C++ but should compile under any
standard ANSI C compiler.
To run the program you must have the Agilent SICL Library, the Agilent
VISA extensions, and an Agilent 82340 or 82341 GPIB module installed
and properly configured in your PC. An Agilent E1406 Command Module
provides direct access to the VXI backplane. The Agilent E2259A must be
installed in an Agilent E2251A Carrier for access to the A16 VXI Registers.
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
ViSession viRM,m_mod
int main()
{
ViStatus errStatus;
/*Status from each VISA call*/
session*/
/* Open the default resource manager */
errStatus = viOpenDefaultRM (&viRM);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpenDefaultRM() returned 0x%x\n”,errStatus);
return errStatus;}
/* Open the M-Module instrument session */
errStatus = viOpen(viRM,INSTR_ADDR, VI_NULL,VI_NULL,&m_mod);
if(VI_SUCCESS > errStatus){
printf(“ERROR: viOpen() returned 0x%x\n”,errStatus);
return errStatus;}
/* read and print the module's ID Register */
errStatus = viIn16(m_mod,VI_A16_SPACE,0x00,&id_reg);
if (VI_SUCCESS > errStatus){
printf(“ERROR: viIn16() returned 0x%x\n”,errStatus);
return errStatus;}
printf("ID register = 0x%hx\n”, id_reg);
/* read and print the module's Device Type Register */
errStatus = viIn16(m_mod,VI_A16_SPACE,0x02,&dt_reg);
if (VI_SUCCESS > errStatus){
printf(“ERROR: viIn16() returned 0x%x\n”,errStatus);
return errStatus;}
printf(“Device Type register = 0x%hx\n", dt_reg);
/* read and print the module's Status Register */
errStatus = viIn16(m_mod,VI_A16_SPACE,0x04,&stat_reg);
if (VI_SUCCESS > errStatus){
printf(“ERROR: viIn16() returned 0x%x\n”,errStatus);
return errStatus;}
Содержание E2259A
Страница 3: ... ...
Страница 5: ...2 Contents Appendix A Agilent E2259A Specifications 45 ...
Страница 9: ...6 Notes ...
Страница 10: ...7 Notes ...
Страница 11: ...8 Notes ...
Страница 37: ...34 Register Descriptions or decimal 2 097 408 16 2 097 424 ...
Страница 49: ...46 Agilent E2259A Specifications ...