Jump to content
  • 0

Channel scan, average, and read timing


belowdabridge

Question

Using UL for .net, ( C# ) I use AloadQueue()  and AInScan(),  my question is:  given a Rate of 10 or 60, what actually happens / what in the timing? 

As I understand, there's input buffer settling time, ( is that fixed, or can I lengthen it ? )  and number of samples averaged ( which affect precision and jitter ),  then the question of when the scan returns - does it grab a current "last read value" or start a read and wait 1/Rate seconds to get the values?

If I scan fewer channels does it return quicker?

My current problem is that scanning 16 channels with Rate at 10, C#'s one second tick ( and I read once a tick ) is coming at ~1.6sec.

Thanks,

dave

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Jeffery,   Yes, USB-2416,  rate as set in C# program,  but now I need to know how are they different?

This is part of the base problem,  I haven't found the documentation that explains what controls what.

Please correct me, but there is the rate at which the ADC scans channel - to - channel  ( and it seems that this is not necessarily all channels at a fixed rate, is it possible to scan channels 0-3, 7-11 at 60 scans / sec. but scan all 16 every 6th scan ( thus 10 scans / sec ) ? )  

I expect that given a scan rate, the buffer settling time and conversion time are set.  ( and at that low scan rate, I'd expect both are at max. )

Then there's the question of averaging.  Is that done in the USB-2416? 

My actual problem is how to get the best readings I can once a second ( I'm using C#'s timer now and it's not keeping time,  I suspect because it's counting millisecond ticks, but NOT when something else is happening, - I don't think I'm doing enough to miss it's interrupt. )

So when I call AInScan(), what happens before it returns?

My stated test requirement is one reading per sec., but I want to keep the HMI updated during the test.  ( And the processor should be idle most of the time.  I've got very little that the program does.

( Oh, thanks for the quick replies, I'd have gotten back to this one sooner, but it was still "wandering around the net" when I checked at 8 last night. )

Thanks,

dave

Link to comment
Share on other sites

  • 0

DATA RATE, the parameter set in InstaCal, is related to settling time.  It is explained in the User's manual (https://www.mccdaq.com/pdfs/manuals/USB-2416.pdf), on pages 16 to 17.  Normally set in InstaCal, but can be set programmatically (which is why I asked you specifically if you were referring to DATA rate or SAMLPING rate, to which you replied "rate").

SAMPLE RATE is the rate at which the AInScan() samples each channel in a scan. Sample rate can only be set programmatically (or in a canned app such as DAQami).

For the USB-2408 and USB-2416 series, these 2 rates are a bit related.  For example:

Option 1, let's assume you want to scan a +/-10 V signal attached to channel 0, set to voltage, as fast as the device is capable.  So In InstaCal you set the DATA RATE for that channel to the highest rate, 3750 Hz.  Run that number through the calculation found on page 16, the resulting value is ~1103 samples per second, max. 

OR, option 2, Let's assume you want to scan a thermocouple (+/- 78 mV range) attached to channel 0, set to temperature, as fast as the device is capable, AND returns good data. So in InstaCal you set the DATA RATE for that channel to 60 Hz.  You set this to 60 Hz to help remove AC line noise from the thermocouple (an very low voltage signal, that can be affected by external electrical noise).  Run that number through the same equation, you get ~55 Hz.

for either option, if you are using multiple channels of all the same and the data rate is set all the same, the the max sampling rate (in your app) would be the 1103 samples per second divided by the number of channels for voltage.  or 55 samples per second divided by the number of channels if TCs

 

This is pretty straight forward when looking at 1 channel or all channels of the sample type in a scan.  But when more channels are used that are a mix of voltage and temperature, i.e. large and small signals, then the second equation on page 16 needs to be used.  This is required so that the A/D converter has time to burn off any residual glitch energy on the multiplexor.

As it states in the User's manual, "You can control the amount of the noise filtering by adjusting the data rate setting. By reducing the data rate, the averaging of samples increases, and noise drops correspondingly. "  To be clear, this averaging etc. is done inside the A/D converter, not in the library and not in your code.  If you would like to learn more about how that works, I recommend you read the data sheet of the A/D converter, ADS1256, 24-bit Sigma Delta.  

Sampling rate, is used in your C# scan app, to set the rate the A/D converter samples voltage(s) from the selected analog input, as configured by the on board crystal oscillator and related circuitry.

In short, you set the data rate to configure the A/D converter's settling time to provide the best, most accurate data for a 24 bit sigma delta converter.  The Data Rate(s) you use, set the maximum sampling rate for the AInScan(). Then based on that value (or those values), you can set the app's A/D sampling rate to specify how fast the A/D can acquire data to your app.

 

Link to comment
Share on other sites

  • 0

So,  if I set the Data Rate in InstaCal ( or with BoardConfig.SetAdDataRate()  )  to 60, and scan 16 channels, it gets just over 3 full scans internally per second. ( This is stored and available, or only read when I ask for it? )   Then the Sample rate, the rate I ask AInScan() for, can be set to 32?  This gets 32 readings in 1 sec or .5 sec to read the 16 channels?  

Is it that if I did that when I run AInScan() it goes channel by channel reading each at the 60 Data rate ( one reading ? )?  Or does the sample rate need to be set to less than Data rate / number of channels?

What happens if the Sample rate is too high?  It tries to read data that's not ready yet?  

Thanks,

dave

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...