User Tools

Site Tools


microprofiling:daqserver_howto

DAQ-server

An application for control of data acquisition (DAQ) devices. It allows you to

  • record analog signals from analog channels,
  • read digital signals from digital channels, and
  • set digital output in digital channels.

Note: DAQ-server has nothing to do with m-Profiler – it’s just another application allowing advanced control of DAQ devices. You don’t need to run it when running m-Profiler. In fact you should not run it simultaneously.

Supported hardware

Any DAQ device from National Instruments, such as

  • DAQ-16XA-50
  • DAQPad-6015
  • DAQPad-6020E
  • USB-6009

Installation instructions

are written here.

Before you start

  1. Make sure you installed the NIDAQ drivers (see Installation instructions)
  2. Plug in the NIDAQ device to the PC (using the provided USB cable, if you use the DAQ-Pad, or into the PCMCIA slot, if you use the DAQ-Card) and to the power supply, and switch the power button on. Check the green LED light on the front to make sure the device is on (for DAQ-Pads). The device should be found by the PC and installed.
  3. Do the following every time you plug in the DAQ device:
    • start the Measurement and Automation explorer (MAX), and make sure the device you plugged in is recognized
    • Note its “Device ID”, which should be something like “Dev0”, “Dev1”, etc.
    • Start the test panel in MAX and check your signal using continuous display at a 10000 Hz sampling frequency. Here you can identify the quality of your signal, particularly the noise level and its frequency (will usually be 50 Hz). If the signal is “good”, close MAX, remembering the device number.

How to control DAQ device with DAQ-server

Interactive control through GUI

  1. Start DAQ-server, and
    • Select the type of DAQ device you have
    • Select device ID (refer to MAX for details of your device settings).
  2. Connect to the device by pressing the Connect button.
  3. Select from which analog inputs you want to read.
  4. Check the digital I/O checkboxes to set the port to IN (input) or OUT (output). If the port is OUT, set it to high/low (1/0) by checking/unchecking the corresponding box.
  5. By pressing the Read button, number of samples (specified in Samples) will be read with the sampling frequency (Samp F), each corresponding to an average of Avg readings. Samples will be taken every dt seconds (see GUI on the right). Recommended settings to average out the 50-Hz noise from your data: Samp F = 10000, Avg readings=2000.
  6. Clicking on the Record data button will open a new window which allows you to record data over extended time periods. You need to specify the output filename (empty for displaying but not recording), number of samples to be read and the interval and click on Start. Click Stop to stop recording. You can also add a comment to the specified output filename by typing it into the edit field below the graph and pressing the Write button (F9).

Remote control through TCP/IP

DAQ-device connected to the DAQ-server can also be controlled remotely using ASCII commands. Commands can be sent by any client connected to the DAQ-server through the TCP/IP protocol (e.g., with G-client).

Syntax

  • Each command must end with a semicolon (;)
  • Multiple commands separated by a semicolon are also supported
  • The string of commands must end with \n\r (carriage return + line feed), i.e., the client application must end each command string with \n\r when sending it to the server!

Recognized commands

id N; set the device ID to N; (check with MAX before!)
type T; set type of DAQ to N, where
N=0 for a dummy device; N=1 for DAQ-16XA-50 PCMCIA card (traditional device); N=2 for DAQ-PAD-6015 (DAQmx device); N=3 for DAQ-PAD-6020E (traditional); N=4 for USB-6009 (DAQmx, min driver NIDAQ 8.0!)
con; connect DAQ device
dis; disconnect DAQ device
avg N; set number of averages to N; this amount of readings will be read and averaged in order to acquire a data sample
sample N; set the number of data samples to be read to N
dt N; set the time interval of sample reading to N seconds. can be a real number (e.g., dt 0.5;)
setai ABC; specify which analog channels should be read by the readai command
readai; read samples from analog channels specified by setai
setdo Aa Bb Cc; set ditigal channels A, B and C to output, and set their respective status to a, b and c;
getdi ABC; set digital channels A, B and C to input and read their respective status
?; inquire about the status of the DAQ device
pause N; make a pause of N seconds, doing nothing
recfile F; set the recording file name to F
recsamples N; set the number of samples to be recorded to N
recdt N; set the interval between sample recording to N (can be a real number)
start; start data recording (open the data recorder window to see the progress)
stop; stop data recording (when the data recorder window is open!)

Examples

  • To record 20 samples every second from analog inputs 0, 1 and 2, send this to the server: setai 012; sample 20; dt 1; readai;\n\r
  • To set the digital output channel 0 to 1 (high) and the channel 1 to 0 (low), send this to the server: setdo 01 10;\n\r
microprofiling/daqserver_howto.txt · Last modified: 2013/09/10 12:22 by lpolerec

Page Tools