|
DAQ Command™ is a simple to use tool to acquire data from DAQ hardware and set output values of the DAQ hardware. In other words, DAQ Command can automate control systems with virtually no additional effort.
Here is how it works:
First use DAQ Plot to configure your DAQ hardware. You can use its intuitive strip chart display to see your sensor output and to make sure your system is configured and working. Then save the configuration to a DAQ Command file.
Then in your own application make a call to the DAQCC_start() function, which will start the DAQ processing.
To read the next time sample worth of data from the DAQ hardware use this code:
float inputSamples[16];
DAQCC_read_samples(inputSamples);
inputSamples contains up to 16 voltage values measured from your DAQ hardware. Calling DAQCC_read_samples(inputSamples) again will get the next time sample worth of data. By looping over that call you can stream data to your application.
To set the two analog outputs of the DAQ hardware to 2 and 3 volts, for example, use this code:
DAQCC_set_analog_outputs(2.0, 3.0);
Of course, you can insert any volt value between 0 and 5. To set the digital outputs of the DAQ hardware to 0 and 1 states use this code:
DAQCC_set_digital_outputs(s1, s2, s3, s4, s5, s6, s7, s8);
Where s1, ..., s8 are 0 or 1 values accordingly.
By looping over reading the next time sample worth of data and setting the analog or digital outputs you can form your own feedback control loop and automate your control system.
The rest is a variation on a theme. Read input values, process them and write output values. You can use DAQ Plot's built in processing to smooth out the data, reduce the data rates with oversampling and then bin averaging, take real-time derivatives and integration, trigger events or simply use it as a voltage data logger. A lot of the hard work is taken care of for you, and you can verify that your setup is working with DAQ Plot's intuitive graphical interface before writing any code.
The example Xcode project that comes with DAQ Command is written in plain C which means you can write your own real-time automated process control system using the most advanced tools on Mac OS X. You can also use the DAQ Command tool to write your processing in one of the many script languages that come standard with Mac OS X. Because the example project is complete you can compile it, run it and add your own processing right away.
|