Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| daq-and-datalogging:documents:acquiring-analog-waveforms [2023/06/14 05:50] – created Scandiweb | daq-and-datalogging:documents:acquiring-analog-waveforms [2023/07/27 21:28] (current) – Arthur Brown | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== TechTip: | + | ====== TechTip: Acquiring |
| - | + | ||
| - | ===== Acquiring | + | |
| **Objective**\\ | **Objective**\\ | ||
| - | To show how to read a single | + | To show how to capture an analog |
| **Intended Audience**\\ | **Intended Audience**\\ | ||
| - | Data acquisition system developers who need to occasionally read an AI channel, and seek to understand | + | Data acquisition system developers who need to digitize |
| **Overview**\\ | **Overview**\\ | ||
| - | Analog input DAQ devices are usually touted for their high-speed continuous AI sampling prowess. But when used in this manner, the amount of data generated | + | For very slowly changing analog phenomena, it can suffice |
| - | For USB DAQ, the time required | + | MCC’s AI DAQ devices incorporate on-board timing circuits |
| - | Often the user will set up a software timer (or timed loop) since a new voltage reading is often needed over and over. Other tasks, such as sending a value to a DAQ output channel based on the voltage input value, can also reside in the loop. Such a loop is often referred | + | An application developer |
| - | As the number of AI channels in your application and/or the sample rate increases, this single-read approach may not meet your overall throughput needs. Also, if your application does not need “access” to each and every sample as it becomes available, such as in the case where you will process data in larger arrays or analyze data only at the end of the run, then you should consider | + | For a non-continuous scan, independent |
| - | Independent | + | *AI channel numbers |
| - | + | *Number | |
| - | *AI channel # | + | *Clock rate |
| *Input range | *Input range | ||
| - | | + | |
| - | And the following two pieces of information are returned: | + | |
| - | *Voltage reading | + | In addition |
| - | *Error code | + | |
| - | + | ||
| - | The examples below show how to sample a single AI reading using the Universal Library™, UL for Android™, NI LabVIEW™, and DASYLab®.\\ | + | |
| - | Universal Library\\ | + | The examples below show how to perform a non-continuous scan using the [[/ |
| - | The following example shows how to sample an AI value using the Universal | + | |
| + | **Universal Library**\\ | ||
| + | |||
| + | The following example shows how to perform a non-continuous scan using the Universal | ||
| + | |||
| + | LowChan = 0\\ | ||
| + | HighChan = 0 ' | ||
| + | Count = 50000 ' | ||
| + | Rate = 50000 ' | ||
| + | Range = MccDaq.Range.Bip10Volts ‘Specify the +/- 10V input range\\ | ||
| + | ULStat = DaqBoard.AInScan(LowChan, | ||
| + | |||
| + | The sample data is returned to a buffer in PC memory at the provided handle, while the error code is returned as the value of ULStat.\\ | ||
| + | |||
| + | Next we copy the data from the memory buffer to a local program array, named ADData:\\ | ||
| + | |||
| + | ULStat = MccDaq.MccService.WinBufToArray(MemHandle, | ||
| + | |||
| + | Up until now, the data has been transferred and stored in the counts format for efficiency purposes. | ||
| + | |||
| + | ULStat = DaqBoard.ToEngUnits(Range, | ||
| - | Channel = 0 ’Specify channel # 0\\ | ||
| - | Range = MccDaq.Range.Bip10Volts ’Specify the ±10 V input range\\ | ||
| - | ULStat = DaqBoard.VIn (Channel, Range, DataValue, Options)\\ | ||
| - | The voltage reading is returned as the DataValue, while the error code is returned as the value of ULStat.\\ | ||
| - | |||
| **UL for Android**\\ | **UL for Android**\\ | ||
| - | The following example shows how to sample an AI value using UL for Android and Java.\\ | + | The following example shows how to perform a non-continuous scan using UL for Android and Java:\\ |
| - | < | + | lowChan = 0;\\ |
| - | //Establish connection to the DAQ device | + | highChan = 0; //Collect from just channel 0\\ |
| - | mDaqDevice.connect(); | + | mode = ChannelMode.SINGLE_ENDED; //Specify configuration mode\\ |
| - | // Read AI channel | + | range = Range.BIP10VOLTS; |
| - | AiDaqDevice mAiDevice | + | samplesPerChan = 50000; //Specify the number of samples per channel\\ |
| - | aInValue | + | rate = 50000; //Specify the per-channel clock rate\\ |
| - | AiUnit.VOLTS) | + | mUnit = AiUnit.VOLTS; //Specify voltage units\\ |
| - | </ | + | actualScanRate |
| - | The voltage reading | + | Collect the values by calling the aInScan () function. |
| **NI LabVIEW**\\ | **NI LabVIEW**\\ | ||
| - | The following example shows how to sample an AI value using LabVIEW. The wiring diagram below shows the pertinent VIs and settings. | + | The following example shows how to perform a non-continuous scan using NI LabVIEW. The wiring diagram below shows the pertinent VIs and settings. |
| - | + | ||
| - | {{https:// | + | {{https:// |
| DASYLab\\ | DASYLab\\ | ||
| - | Non-programmers | + | Non-programmers |
| + | |||
| + | The following example worksheet shows an Analog Input module with its output wired to a Y/t Chart Display | ||
| + | |||
| + | |||
| + | |||
| + | {{https:// | ||
| + | |||
| + | Double-clicking on the Analog Input module opens a dialog box you can use to enable the desired channels, select the input range, and specify the sample rate.\\ | ||
| + | |||
| + | {{https:// | ||
| + | |||
| + | **DAQami**\\ | ||
| + | The following example shows the DAQami Acquisition page, where you set the Sample Rate and Sample Count.\\ | ||
| + | |||
| + | {{https:// | ||
| - | {{https://files.digilent.com/resources/ | + | The resulting data is plotted on the [[/software/daqami/start| DAQami]] display page:\\ |
| - | Double-clicking on the Analog Input module allows you to access menus where you can select the N samples mode. | ||
| - | Here we specify 1 for N (the number of samples.)\\ | ||
| - | {{https:// | + | {{https:// |
| - | More Information\\ | ||
| - | Please contact Measurement Computing Corporation if you have any questions or if you would like any further information.\\ | ||
| - | | + | **More Information**\\ |
| - | *Phone: 508-946-5100\\ | + | Please reach out to our support team on the Digilent Forum if you have any questions: [[https://forum.digilent.com/]] |
| - | *Fax: 508-946-9500\\ | + | |
| | | ||
| - | Additional TechTips are available | + | Additional TechTips are available |

