Chapter 9 Letting an Outside Source Control Your Acquisition Rate. NI LabVIEW Data Acquisition Basics

Add to My manuals
295 Pages

advertisement

Chapter 9 Letting an Outside Source Control Your Acquisition Rate. NI LabVIEW Data Acquisition Basics | Manualzz

Letting an Outside Source

Control Your Acquisition Rate

Chapter

9

Typically, a data acquisition (DAQ) device uses internal counters to determine the rate to acquire data, but sometimes you might need to capture your data at the rate of particular signals in your system. For example, you can also read temperature channels every time a pulse occurs which represents pressure rising above a certain level. In this case, internal counters are inefficient for your needs. You must control your acquisition rate by some other, external source.

You could compare a scan of your channels to taking a snapshot of the voltages on your analog input channels. If you set your scan rate to 10 scans per second, you are taking 10 snapshots each second of all the channels in your channel list. In this case, an internal clock within your device (the scan clock) sets the scan rate, which controls the time interval between scans.

Also, remember that most DAQ devices (those that do not simultaneously sample) proceed from one channel to the next depending on the channel clock rate. Therefore, the channel clock is the clock controlling the time interval between individual channel samples within a scan, which means the channel clock proceeds at a faster rate than the scan clock.

The faster the channel clock rate, the more closely in time your system samples the channels within each scan, as shown in Figure 9-1.

National Instruments Corporation 9-1 LabVIEW Data Acquisition Basics Manual

Chapter 9 Letting an Outside Source Control Your Acquisition Rate

Note: For devices with both a scan and channel clock, lowering the scan rate does not change the channel clock rate.

Figure 9-1. Channel and Scan Intervals Using the Channel Clock

Some DAQ devices do not have scan clocks, but rather use round-robin scanning . Figure 9-2 shows an example of round-robin scanning.

Figure 9-2. Round-Robin Scanning Using the Channel Clock

The devices that always perform round-robin scanning include:

NB-MIO-16, PC-LPM-16, DAQCard-500, DAQCard-700, Lab-NB,

Lab-SE, and Lab-LC. With no scan clock, the channel clock is used to switch between each channel at an equal interval. The same delay exists between all channel samples, as well as between the last channel of a scan and the first channel in the next scan. (For boards with scan and channel clocks, round-robin scanning occurs when you disable the scan clock by setting the scan rate to zero and using the interchannel delay of the AI Config VI to control your acquisition rate.)

Finally, remember that LabVIEW is scan-clock oriented . In other words, when you select a scan rate, LabVIEW automatically selects the channel clock rate for you. LabVIEW selects the fastest channel clock rate that allows adequate settling time for the Analog-to-Digital

Converter (ADC).

LabVIEW adds an extra 10-

µ s to the interchannel delay to compensate for any unaccounted factors. However, LabVIEW does not consider this additional delay for purposes of warnings. If you have specified a scan rate that is adequate for acquisition but too fast for LabVIEW to

LabVIEW Data Acquisition Basics Manual 9-2  National Instruments Corporation

Chapter 9 Letting an Outside Source Control Your Acquisition Rate apply the 10-

µ s delay, it configures the acquisition but does not return a warning.

You can set your channel clock rate with the interchannel delay input of the AI Config VI, which calls the Advanced AI Clock Config VI to actually configure the channel clock. The simplest method to select an interchannel delay is to gradually increase the delay, or clock period, until the data appears consistent with data from the previous delay setting.

Refer to your hardware manuals for the required settling time for your channel clock. You can also find the interchannel delay by running the low-level AI Clock Config VI for the channel clock with no frequency specified.

Externally Controlling your Channel Clock

There are times when you might need to control the channel clock externally. The channel clock rate is the same rate at which analog conversions occur. For instance, suppose you need to know the strain value at an input, every time an infrared sensor sends a pulse. Most

DAQ devices have an EXTCONV* pin on the I/O connector for providing your own channel clock. This external signal must be a TTL level signal, where the actual conversion occurs on the falling edge of the signal, as shown in Figure 9-3. With devices that have a RTSI connector, you can get your channel clock from other National

Instruments DAQ devices. rising edge falling edge

TTL Signal

Figure 9-3. Example of a TTL Signal

Figure 9-4 shows you the Getting Started Analog Input example VI, located in examples \ daq \ run_me.llb

. This example demonstrates how to set up your acquisition for an externally controlled channel

National Instruments Corporation 9-3 LabVIEW Data Acquisition Basics Manual

Chapter 9 Letting an Outside Source Control Your Acquisition Rate clock. The Getting Started Analog Input VI places acquired data in a buffer. For purposes of this discussion, the VI was slightly altered and now includes the AI Clock Config VI and the clock source was connected to the I/O connector.

Note:

Figure 9-4. Getting Started Analog Input Example VI

You can enable external conversions by calling the Advanced-level AI

Clock Config VI. Remember that the AI Clock Config VI, which is called by the AI Config VI, normally sets internal channel delay automatically or manually with the Interchannel Delay control.

However, calling the AI Clock Config VI after the AI Config VI resets the channel clock so that it comes from an external source for external conversion. Also, notice that the scan clock is still set internally on those devices that have a scan clock. If you want round-robin scanning for those devices that support both scan and channel clocks, change the scan rate to 0 .

Dynamic signal acquisition (DSA) devices, like the AT-A2150, do not support external conversion pulses.

On most devices, external conversions occur on the falling edge of the

EXTCONV* line. Consult your hardware reference manual for timing diagrams. On the MIO-E series devices, you can set the Clock Source

Code input of AI Clock Config VI to the PFI pin with either falling or

LabVIEW Data Acquisition Basics Manual 9-4  National Instruments Corporation

Chapter 9 Letting an Outside Source Control Your Acquisition Rate rising edge or use the default PFI2/Convert* pin where the conversions occur on the falling edge, as shown in Figure 9-5.

Figure 9-5. Setting the Clock Source Code for External Conversion Pulses for E Series Devices

Note:

Note:

The AT-MIO-16, AT-MIO-16D, NB-MIO-16, and NB-MIO-16X cannot support both an external channel clock and a digital trigger signal at the same time. You must choose one or the other.

Because LabVIEW determines the length of time before the AI Read

VI times out based on the interchannel delay and scan clock rate , you may need to force a time limit for the AI Read VI, as shown previously in Figure 9-4.

On the Lab-PC+, SCXI-1200, DAQPad-1200, and DAQCard-1200, the first clock pulse on the EXTCONV* pin configures the acquisition but does not cause a conversion. However, all subsequent pulses cause conversions.

Externally Controlling your Scan Clock

External scan clock control may be more useful than external channel clock control if you are sampling multiple channels, but may not be as obvious to find because it does not have the input on the I/O connector labeled “ExtScanClock,” the way the EXTCONV* pin does.

National Instruments Corporation 9-5 LabVIEW Data Acquisition Basics Manual

Chapter 9 Letting an Outside Source Control Your Acquisition Rate

Note:

Note:

Some MIO devices have an output on the I/O connector labeled

ScanClock . This cannot be used as an input.

The appropriate pin to input your external scan clock can be found in the Table 9-1.

Table 9-1. External Scan Clock Input Pins

Device External Scan Clock

Input Pin

Out2 AT-MIO-16

AT-MIO-16F-5

AT-MIO-16X

AT-MIO-16D

AT-MIO-64F-5

All E Series Devices Any PFI Pin

OutB1 Lab-PC+

SCXI-1200

DAQPad-1200

DAQCard-1200

Some devices do not have internal scan clocks and therefore do not support external scan clocks. These devices include: NB-MIO-16,

PC-LPM-16, DAQCard-700, DAQCard-500, Lab-NB, Lab-SE, and Lab-LC.

After connecting your external scan clock to the correct pin, set up the external scan clock in software. For example, in the Getting Started

Analog Input Example VIs, located in examples \ daq \ run_me.llb

, you would configure the external scan clock by setting the Scan Clock

Source control to 2 (I/O connector) in the AI Start VI as shown in

Figure 9-6. This disables the internal scan clock from driving the scan clock circuitry. You do not need to specify a scan rate value because

LabVIEW Data Acquisition Basics Manual 9-6  National Instruments Corporation

Chapter 9 Letting an Outside Source Control Your Acquisition Rate your device ignores this value when you set it up to use an external scan clock.

Figure 9-6. Externally Controlling Your Scan Clock with the Getting Started Analog Input Example VI

The NB-MIO-16X cannot support external scan clocks as the other devices can. The device layout does not allow you to directly provide an external scan clock. Instead, you can offer a timebase to the internal counter, counter 5, that generates the scan clock. Do this by sending a timebase into the source 5 pin and calling the Advanced VIs used by the AI Clock Config VI. In addition, you need to wire the alternate clock rate specifications as shown below into the AI Clock Config VI.

Remember that the which clock input of the AI Clock Config VI should be set to scan clock (1) .

National Instruments Corporation 9-7 LabVIEW Data Acquisition Basics Manual

Chapter 9 Letting an Outside Source Control Your Acquisition Rate

Note: You must divide the timebase by some number between 2 and 65535 or you will get a bad input value error.

Because LabVIEW determines the length of time before AI Read times out based on the interchannel delay and scan clock rate, you may need to force a time limit into AI Read. In Figure 9-6, the time limit is

5 seconds.

Externally Controlling the Scan and Channel Clocks

You can control the scan and channel clocks simultaneously by combining the two previous sections. However, make sure that you follow the proper timing. Figure 9-7 demonstrates how you can set up your application to control both clocks.

Figure 9-7. Controlling the Scan and Channel Clock Simultaneously

LabVIEW Data Acquisition Basics Manual 9-8  National Instruments Corporation

advertisement

Related manuals

Download PDF

advertisement

Table of contents