National Instruments NI-488.2 User Manual page 73

National instruments user manual ni-488.2
Hide thumbs Also See for NI-488.2:
Table of Contents

Advertisement

Chapter 7
NI-488.2 Programming Techniques
int __stdcall MyCallback (int ud, int LocalIbsta, int LocalIberr,
int ReadingsTaken = 0;
float Readings[1000];
BOOL DeviceError = FALSE;
char expectedResponse = 0x43;
int main()
{
int ud;
// Assign a unique identifier to the device and store it in the
// variable ud. ibdev opens an available device and assigns it to
// access GPIB0 with a primary address of 1, a secondary address of 0,
// a timeout of 10 seconds, the END message enabled, and the EOS mode
// disabled. If ud is less than zero, then print an error message
// that the call failed and exit the program.
ud = ibdev
1,
0,
T10s,
1,
0);
if (ud < 0)
printf ("ibdev failed.\n");
return 0;
}
// Issue a request to the device to send the data. If the ERR bit
// is set in ibsta, then print an error message that the call failed
// and exit the program.
ibwrt (ud, "SEND DATA", 9L);
if (ibsta & ERR)
printf ("unable to write to device.\n");
return 0;
}
// set up the asynchronous event notification on RQS
ibnotify (ud, RQS, MyCallback, NULL);
NI-488.2 User Manual for Windows
because of the way they are used in the application: only a single thread is
writing the global values and that thread only adds information (increases
the count or adds another reading to the array of floats).
long LocalIbcntl, void *RefData);
(0,// connect board
// primary address of GPIB device
// secondary address of GPIB device
// 10 second I/O timeout
// EOT mode turned on
// EOS mode disabled
{
{
7-6
www.natinst.com

Advertisement

Table of Contents
loading

Table of Contents