Configuration Example - HP E1418A User Manual

8/16-channel d/a converter module
Hide thumbs Also See for E1418A:
Table of Contents

Advertisement

Configuration
Example
/** FUNCTION PROTOTYPES **/
void main (void);
void err_handler(ViSession vi, ViStatus x);
void sys_err(ViSession resource);
/** GLOBAL **/
ViStatus err;
ViSession defaultRM, cmd, dac;
void main (void)
{
int i,num_chan,result = {0},config [6]={0};
char buf[256] = { 0 };
/*** Check the module identification
err=viPrintf(dac, "*IDN?\n");
err=viScanf(dac, "%t", &buf);
printf ("Module is identified as a %s\n", buf);
/*** Get the module configuration
err=viPrintf(dac, "DIAG:CONF?\n");
err=viScanf(dac, "%,6d", &config);
/* Decode the first integer */
result=config[0];
if (result < 7)
else
42
Programming Examples
The following program segment demonstrates how to read the module
identification string and the configuration. The configuration integers are
bit manipulated using the C operator for bit shifting result = result <<1
(a one bit shift to the left).
/* Expansion board */
{
printf ("Module is a 16 channel device\n");
num_chan = 16;
}
{
printf ("Module is an 8 channel device\n");
num_chan=8;
}
/* VTL error routine
/* Checks for SCPI programming errors */
***/
/* request id from the module */
/* enter string returned
/* print the result
***/
/* request module configuration */
/* returns six integers
*/
*/
*/
*/
Chapter 2

Advertisement

Table of Contents
loading

Table of Contents