Programming in G Mode
Chapter 6
GPIB-SCSI-A User Manual
6-2
© National Instruments Corp.
Note:
This example uses the National Instruments NI-488 functions for
an Apple Macintosh computer using THINK C.
char *wrtbuf, *rdbuf;
int gpibscsia;
if (gpibscsia = ibfind("gpibscsia"))
/* Open GPIB communications with the
* Command and Status Channel
*/
{
printf("gpibscsia not found.\n");
ExitToShell();
}
rdbuf = calloc (200, 1);
wrtbuf = calloc (15,1)
/* Allocate memory for the buffers. This call
* also clears the memory to nulls.
*/
if ((rdbuf == NULL) || (wrtbuf == NULL))
/* Make sure that the buffers were allocated. */
{
printf("Out of memory.\n");
ExitToShell();
}
strcpy (wrtbuf, "id\n");
/* Assign a programming message to the string
* buffer. The '\n' will put an <LF> at the end
* of the command.
*/
ibwrt (gpibscsia, wrtbuf, 3);
/* Command the GPIB-SCSI-A to report system
* identification.
*/
ibrd (gpibscsia, rdbuf, 1000);