Useful DAQ commands Compile command gcc -o outfile filename.c /usr/local/lib/gpib/cib.o -lm The following commands are for system setup, and are generally used once at either the beginning or end of the program. Except for the buffer clear command. This command creates a pointer for the data output file FILE *fp; Opens file in the append mode. If file is not opened in the append mode, it will overwrite what is currently in the file. fp=fopen(“filename.dat”,”a”); Tells PC the address of the data acquisition unit. DAQ = ibdev(0, 10, 0, 10, 0, 1); Clears output buffer if DAQ. This command must be executed before each scan, or errors will occur in your data. ibclr(DAQ); Tells DAQ that it will operate in GPIB mode. This command is done once near the beginning of the program. ibwrt(DAQ, “SYST:INT GPIB \n”, 16L); Close data file. fclose(fp); Take DAQ offline. ibonl(DAQ,0); The following commands are used for the actual taking of data, and are repeated for however many channels are being used. NOTE: remember to clear output buffer before each scan. Configure channel 01 of card 1 to temperature measurement using type K thermocouple. The first number of 101 is the slot card, the second and third numbers are the channel number. ibwrt(DAQ, "CONF:TEMP TC,K,(@101) \n", 24L); Follow with to give equipment time to respond to configuration command. sleep(2); Set the length of time that DAQ samples input. ibwrt(DAQ, "SENS:TEMP:NPLC 20,(@101) \n", 27L); Tell the DAQ which channel to monitor for input. ibwrt(DAQ, "ROUT:SCAN (@101) \n", 18L); Initiate scan. ibwrt(DAQ, "INIT \n", 7L); This sleep allows the scan to finish before sending it to the device buffer. sleep(1); Send data to device buffer of DAQ so that it can be read by the interface board. ibwrt(DAQ, "FETCH? \n", 8L); Read what is in the device buffer. ibrd(DAQ, ReadBuffer, 15L); Convert readbuffer to floating point and place in variable address. sscanf(ReadBuffer, "%f", &temp); Print thermocouple measurement to screen and then to file. printf("Water bath temperature in Celsius: %f\n", temp); fprintf(fp," %f\n", temp); The following commands are for 4-wire resistance measurements. These commands replace the temperature commands for thermocouples. Configure DAQ for four-wire ohm measurement. ibwrt(DAQ, "CONF:FRES AUTO,(@101) \n", 24L); Set time length of scan. ibwrt(DAQ, "SENS:FRES:NPLC 20,(@101) \n", 27L); The following commands are for voltage measurements. These commands replace the temperature commands for thermocouples. Configure DAQ for DC voltage measurement. ibwrt(DAQ, "CONF:VOLT:DC AUTO,(@101) \n", 27L); Set time length of scan. ibwrt(DAQ, "SENS:VOLT:NPLC 20,(@101) \n", 27L);