LRN.C

This program uses a 2,000 element character array. To prevent stack overflow errors when compiling and running this program using Microsoft® QuickC©, c hange the stack size using the /F option of the “ qcl” command. An example of how this program might be compiled is:

qcl /AL /F 8192 b:\lrn.c c:\qc2\lib\clhpib.lib

/* LRN.C - This program queries the digitizer’s reset conditions */

/* Include the following header files */

#include

<stdio.h>

 

#include

<string.h>

 

#include

<cfunc.h>

/* This file is from the HP-IB Command Library Disk */

#define ADDR 70905L

/* I/O path from PC to the digitizer, via the E1406 */

/****************************************************************************/

void main(void)

/* Run the program */

{

 

 

char static *codes[] = {"*RST","*LRN?;*OPC?"};

char

lrndata[2000], *prt, ch;

int

loop,

 

 

length = 2000;

 

/* Execute each command group using a loop */

for (loop = 0; loop < (sizeof(codes) / sizeof(char*)); loop++ ) IOOUTPUTS( ADDR, codes[loop], strlen(codes[loop]));

/* Enter data returned by *LRN into string */

IOENTERS(ADDR, lrndata, &length);

/* Start line counter */ loop = 1;

/* Separate *LRN? data into tokens delimited by ";". Read and */ /* print the first *LRN? data point */

Continued on Next Page

26 Getting Started

Chapter 1

Page 26
Image 26
HP E1429A manual Lrn.C