How to Calculate the Maximum Frequency of a USB-2408 or USB-2416 in Your Program.

The USB-2408 Series and USB-2416 Series boards 24 bit data acquisition devices. They can accurately measure voltages and Thermocouple signals on the same device, configured as adjacent channels if need be. To get the most accurate reading from your thermocouples, you need to set the “Data Rate” to a low frequency such as 60 Hz. Per the User's manual, to calculate the maximum sampling frequency, you have to use the equation:

Using the top equation with 1 channel, set to thermocouple, with a data rate of 60 hz, the maximum single channel throughput is 57.78Hz (samples per second). If you run through these calculations, you can see the more channels you have, the slower the sample rate.

Some software packages like DASYLab will tell you what the max sampling rate is, as will the UL. the UL is a special case, if you set the rate to 0 in your AInScan parameters, the function call return will inform you of the rate. That's good, but you are informed of it post process. You could be waiting for some time to find that out.

Here is some VB.NET code you can add to your program. it will access the device and run the calculation for you. There are 3 steps to include for this process:

1. At the top of the code module for the form, add: Imports System.Runtime.InteropServices

2. In the Public Class area of the Form:

    <DllImport("cbw32.dll")> _
   Public Shared Function cbGetConfig(ByVal InfoType As Integer, ByVal BoardNum As Integer, _
   ByVal DevNum As Integer, ByVal ConfigItem As Integer, ByRef ConfigVal As Long) _
        As Long
    End Function

This is how to call a UL function that is of 'non-managed' code meaning it is not part of MCCDAQ.DLL, but of lower level CBW32.DLL

3. In an appropriate place in your program, I recommend you put this before the ULStat = DaqBoard.AInScan()

        'how to calculate the max sampling rate (A/D pacer)
        'The equation is: ADPacer = 1/(Sum of(1/CHfreq + 640uS))
        'Where CHfreq is the sampling rate for each channel as set in InstaCal.
        numADchannels = HighChannelNumber - LowChannelNumber + 1
        Dim Boardinfo As Integer = 2
        Dim BITEMPREJ As Integer = 121
        Dim CHFreq As Integer
        Dim MaxFreq As Single
        For ChannelIndex = LowChannelNumber To HighChannelNumber   'numADchannels
            RetStat = cbGetConfig(Boardinfo, Daqboard.BoardNum, ChannelIndex, BITEMPREJ, CHFreq)
            MaxFreq = MaxFreq + (1 / CHFreq + 0.00064)
        Next
        MaxRate = Math.Floor(1 / MaxFreq)

The parameter 'MaxRate' is the value you are looking for. From here you can just inform the program operator of this new found information, or if they have entered a rate that is larger than this rate, you can not only inform them there is a problem with their selection, but you can also correct their error.

Happy Programming! Jeff