Jump to content

JRys

MCC Staff
  • Posts

    1,599
  • Joined

  • Last visited

Reputation Activity

  1. Like
    JRys got a reaction from ThomMoun in USB-1208FS C language   
    Hello,
    I have yet to try to use DevC++ IDE or Code: Blocks on Windows. MCC uses Microsoft Visual Studio. I recommend downloading the free Community version of Visual Studio for your project. Create a 32-bit C console project and add to it the cbw.h, cbw32.lib files and your code file. Below is a simple 32-bit C console program that toggles D0 on FirstPortA and D0 or FirstPortB.
    #include "stdafx.h"
    /* Include files */
    #include <windows.h>
    #include <stdio.h>
    #include <conio.h>
    #include <string.h>
    #include "cbw.h"

    #define MAXNUMDEVS 100
    void main()
    {
        /* Variable Declarations */
        int ULStat = 0;
        int numberOfDevices = MAXNUMDEVS;
        DaqDeviceDescriptor inventory[MAXNUMDEVS];
        DaqDeviceDescriptor DeviceDescriptor;
        int BoardNum = -1;
        float Rev = (float)CURRENTREVNUM;
        ULStat = cbDeclareRevision(&Rev);
        cbErrHandling(PRINTALL, STOPALL);
        printf("Digital output demonstration\n\n");
        //Ignore InstaCal device discovery
        cbIgnoreInstaCal();
        //locate USB devices
        ULStat = cbGetDaqDeviceInventory(USB_IFC, inventory, &numberOfDevices);
        for (int i = 0; i < numberOfDevices; i++)
        {
            DeviceDescriptor = inventory[i];
            //Product IDs can be found in ULProps.txt located in 
            // C:\Program Files (x86)\Measurement Computing\DAQ
            if (DeviceDescriptor.ProductID == 0xE8) 
            {
                BoardNum = i;
                ULStat = cbCreateDaqDevice(BoardNum, DeviceDescriptor);
                printf("Device Name: %s\n", DeviceDescriptor.ProductName);
                break;
            }
        }
        if (BoardNum < 0)
        {
            printf("USB device not found...press any key to exit\n");
            getch();
            return;
        }
        ULStat = cbDConfigPort(BoardNum, FIRSTPORTA, DIGITALOUT);
        ULStat = cbDConfigPort(BoardNum, FIRSTPORTB, DIGITALOUT);
        unsigned short dataValue = 0;
        while (!_kbhit())
        {
            ULStat = cbDOut(BoardNum, FIRSTPORTA, dataValue);
            ULStat = cbDOut(BoardNum, FIRSTPORTB, dataValue);
            dataValue = 1;
            ULStat = cbDOut(BoardNum, FIRSTPORTA, dataValue);
            ULStat = cbDOut(BoardNum, FIRSTPORTB, dataValue);
            dataValue = 0;

            if (ULStat != 0){
                printf("Digital IO error\n");
                break;
            }
        }

        cbReleaseDaqDevice(BoardNum);
        printf("Completed...press any key to exit\n");
        getch();
    }

     
  2. Like
    JRys got a reaction from jpavlich in continuous scans USB-1608gx and USB-1808x   
    Hello,
    num_points is a 32-bit integer, so the value can be quite large. Size the buffer to hold one second of data, usually, this is big enough. Buffers need to be at least a multiple of the USB packet size * the number of channels. A buffer is allocated using win_buf_alloc. The USB-1808X will use win_buf_alloc32. The USB-1608GX-2AO packet is 256, the USB-1808X is 128. Take a look at the attached Python script.
    Best regards,
    John
    a_in_scan_USB_1608G.txt
  3. Like
    JRys got a reaction from mzlatinov_erg in USB-2416 Digital I/O not available in InstaCal   
    Your USB-2416 analog input channel must be configured with the InstaCal utility, not the digital IO. To set the digital IO direction with LabVIEW, place a ULx Create Channel VI on the block diagram and change the bottom selector from Analog Input to Digital Input or Output. Do this before connecting any wires. The ULx LabVIEW digital IO examples are in \National Instruments\LabVIEW 2022\Examples\ULx\Digital. To test the outputs, open the library called Generate Values.llb and run ULx Write Dig Chan.vi. To test the inputs, open the library called Read Values.llb and run ULx Read Dig Chan.vi.
  4. Like
    JRys got a reaction from Michelle Joon in USB-2404-10 MC and Matlab   
    According to MatLab's website, the USB-2404-10 is supported.
    https://www.mathworks.com/hardware-support/measurement-computing.html
    You must install InstaCal and have the MatLab Data Acquisition Toolbox to use it. We don't provide MatLab technical support, but we have some articles explaining the basics.
    https://kb.mccdaq.com/KnowledgebaseArticle50721.aspx
    https://kb.mccdaq.com/KnowledgebaseArticle50723.aspx
  5. Like
    JRys got a reaction from mzlatinov_erg in USB-2416 Digital I/O not available in InstaCal   
    The InstaCal digital IO test is not available for the USB-2416 series. I'm unsure why it was left out while other devices have it; however, instead of InstaCal, use our DAQami program to test the digital IO.  
  6. Like
    JRys got a reaction from Fukuda in How to collect analog input data every trigger edge detection for USB-231   
    The External Trigger input is used to signal the start of data collection. What you need is a device that has an external clock input like the USB-1608G.
    https://digilent.com/shop/mcc-usb-1608g-series-high-speed-multifunction-usb-daq-devices/
     
  7. Like
    JRys got a reaction from cjanand in Execution times using USB-DIO96H   
    National Instruments DAQ's are not compatible with InstaCal. Instead, they use Measurement & Automation Explorer.
    We did not add artificial delays to the USB-DIO96H communication process. 
     
  8. Like
    JRys got a reaction from cjanand in Execution times using USB-DIO96H   
    The USB-DIO96H is not a speedy device, and my test indicates that a single 8-bit port can be updated about 2600 times per second.  I used a 32-bit C program with a while loop to write ones & zeros continuously for my test. To determine the update rate, I measured the output square wave which was about 1300 Hz (2600 updates).
  9. Like
    JRys got a reaction from ScottB in USB-1808X streaming latency   
    Our products are not designed to be control devices, we don't consider them real-time, and there is no published latency information.
  10. Like
    JRys got a reaction from Chandana Narayan in How to read all Port Values at once in USB 1024LS daq ?   
    getDioInfoFirstSupportedPortType is not part of the Universal Library, it is a utility function found only in the examples. The function to configure the direction of a port is ulDConfigPort(BoardNum, PortType, Direction). Your port types are FirstPortA, FirstPortB, FirstPortCL and FirstPortCH. To read an individual bit, use the ulDBitIn function with FirstPortA and bit numbers of 0 to 23. To read a port, use the ulDIn function and one of the four port types. It is not possible to read all four at the same time. The best you can do is to read them one after another. If you do this, expect a 10mS time skew between each read.
    The following is a link to the Linx C UL Help for your device
    https://www.mccdaq.com/PDFs/Manuals/UL-Linux/c/1024ls.html
  11. Like
    JRys got a reaction from Nils in DASylab. Get time difference in milliseconds.   
    Assuming you have a device like the USB-1608G, the digital input is too slow to record the pulses. But you could use two analog inputs to digitize the two pulses at a high sample rate. Connect the analog input signals to a Combi trigger module set to trigger using two signals. Set both the start and stop conditions to the rising edge. One signal will make the Combi output go high and the other will set it back low, producing a pulse. Then use the Pulse Analysis module to measure the pulse width. The whole thing will be clocked using the device time base, which can be set relatively high. 

  12. Like
    JRys got a reaction from cjanand in DIO Board configuration   
    The attached file uses C# to demonstrate how to discover the device and how to program and update the ports. Use the DOut function to update all eight bits on a port and the DBitOut function to update a single line on any port. Note that DBitOut uses FirstPortA as the port type with bit numbers ranging from 0 to 95. The same holds for DBitIn. To run the attached code, use Visual Studio and create a 32-bit C# Console application that references our MccDaq dll. To add the reference, right-click references in the Project Explorer, select Add Reference, select Extensions, find, and select MccDaq from the list. 
    Program.cs
  13. Like
    JRys got a reaction from Nils in Scan Rate Error   
    The HW time base uses the USB-1208HS-4AO internal scanning circuitry to collect data at high speeds. DASYLab and the SW time base are executed in a software loop, so their rate is limited.
    I don't know how fast you can R/W a global variable. I use it primarily to reduce a faster input down to a slower module like the digital output.
  14. Like
    JRys got a reaction from cjanand in USB requires Product Vendor ID - USB-DIO96H   
    Hello,
    The hexadecimal ID number for the USB-DIO96H is 0x92.
    The USB-DIO96H-50, the ID is 0x95.
    Attached is a copy of the ulprops.txt file.
    Best regards,
    John
    ulprops.txt
  15. Like
    JRys got a reaction from Nils in Scan Rate Error   
    Hello,
    The 16-bit port on the USB-1208HS-4AO does not have the high-speed scanning circuitry found on the analog input and output channels. Because of this, it is slow, usually less than 100 Hz, depending on the number of output lines. The module that proceeds the digital output will dictate the output speed. You should use the DASYLab time base for the analog input. Press the Measurement button on its setup dialog to change the time base. 
    The analog output can be fussy. Depending on the update rate, it will want block sizes that can be pretty large. The output's time base, rate, and block size must match the analog input. Try the following: Set the analog input time base to USB-1208HS-4AO Device1 - Input HW. Set the rate to 1000 Hz with a block size of 5000. Set the analog output time base to USB-1208HS-4AO Device1 - Output HW. Set the rate to 1000 Hz with a block size of 5000. You will see a lag between the input and the output; it won't be simultaneous.
    Because there is one analog input time base, if you configure it for analog output, your digital output will generate an error. A way around this issue is to write the analog input value to a global variable. Then use a global variable read module to send the value to the digital output. This separation will allow the analog input to run faster while maintaining the slow speed required by the digital output. 
    If this is your first day with DASYLab, you unknowingly stepped into one of the more difficult DASYLab topics: time bases. 
    Best regards,
    John
  16. Like
    JRys got a reaction from Marc Pearlman in Multiplexing Time Delay on the MCC USB-1608GX   
    Hello,
    The USB-1608GX has a single ADC with multiplexed channels and because of this, there will be a phase difference from channel to channel. The amount of time between each channel depends on the aggregate sample rate. For instance, four channels times 62.5k S/s is 250k S/s. To figure the time between each channel, take the inverse or 1 / 250k or 4uS. At 500k S/s, it's 2uS. The USB-1608GX can run in one of two modes: Burst and non-Burst. Burst Mode forces the device to rapidly sample the channels irrespective of the sample rate. The only way to take advantage of Burst Mode is to create a C or Python program using the Universal Library. MCC's higher-level programs, like DAQami, TracerDAQ, DASYLab, or LabVIEW, cannot enable it.
    There is a downside to Burst Mode. Switching from channel to channel at a high rate reduces the channel settling time. If the connected signals have an output impedance of 100 ohms or less, it is usually not a problem. However, large output impedance sensors, such as resistor dividers, can cause crosstalk between channels because they require more settling time.
    Best regards,
    John
  17. Like
    JRys got a reaction from AlvyAhmed in How can I upgrade the QuickDAQ software's license from FFT Analysis option to Advanced FFT Analysis option?   
    Hello,
    Please get in touch with our Data Translation distributor for India: https://www.mccdaq.com/templates/distributor.aspx?cid=18. I'm pretty sure they handle sales for Bangladesh.
    Best regards,
    John
  18. Like
    JRys got a reaction from Valid in USB-1608G -10V on all channels   
    What you described is a normal operation. The USB-1608G is designed to work with low-impedance (<100 ohms) sources. Open or unconnected channels are high impedance. This causes the inputs to charge to some unknown voltage (-10v sounds right). Connect the other 15 channels to AGND to simulate a low-impedance source. If you do this, you will not see an image of the 16th channel on them.
    Best regards,
    John
     
  19. Like
    JRys got a reaction from F. Y. in Analog outputs cannot calibrate back to 0   
    The analog output accuracy is about 1.8mV plus 0.083% of reading. When set to 5.0 volts, the accuracy is 1.8mV + 0.9mV. When set to zero, if your multimeter reads higher than 1.8mV and is less than a year old, I can arrange for free factory calibration.  Otherwise, the USB-1808X fee is about $150.00. What is the make and model of your multimeter - I would like to check its accuracy too. 
    As for calibrating the device yourself, Measurement Computing chose not to add calibration functions to the programming interface. Instead, you could do something simple like check the offset and adjust each setting by that amount in your code.
    Regarding the Python example, it is normal for the analog output to remain set to the last value. If it is a problem, add the code to put it to zero before the program exits.
     
     
  20. Like
    JRys got a reaction from Ron Byron in What value to use for MccService.DeclareRevision   
    Hello,
    The original intent for DeclareRevision was so that we could make changes or fix bugs and not have to worry that we broke your program. However, we stopped managing it quite some time ago because no matter what you set it to, it returns 5.5, and GetRevision returns 5. One indication that this is true is the GetRevision function. It has a parameter for a VXD library, which was old Visual Basic 6 technology. I think you should use MccService.DeclareRevision(out revNum) where revNum = 6.73. It may not do anything, but later when someone reads your code, they'll know you had InstaCal 6.73. 
    Best regards,
    John
  21. Like
    JRys got a reaction from RPi4-IPC in How to correctly acquire data from multiple Raspberry Pi DAQ Hats without getting overrun errors   
    Yes, it should be possible. Start an acquisition on each board one after the other, then read each board one after the other over and over. This is what the multi_hat_sychronouous_scan example does.  The MCC 152 doesn't have a scan clock; it uses individual reads in a polling fashion and is slow compared to the other boards. You should leave it out for now and focus on controlling the two MCC 172 and the one MCC 128. 
  22. Like
    JRys got a reaction from Kat G in Timestamp on WebDAQ 904   
    Hello
    The .csv conversion tool has an option for relative or absolute time. I've attached an example of two voltage channels with absolute time stamps. 
    Best regards,
    John
    New_today_2023-03-02T16-43-20-723.csv
  23. Like
    JRys got a reaction from winstonsze in About the "Terminal counter output" function of the USB-QUAD08 - Quadrature Encoder USB Device   
    Hello,
    The USB-QUAD08 cannot count to a level and then output a pulse. Instead, use the USB-CTR04. It has a modulus counting mode you could set to count up to 4096 and output a pulse. The count will then roll over to zero and up to 4096 again. Unfortunately, this mode is not supported in our DAQami or DASYLab software or with our LabVIEW support. Requires a C or Python program for control.
    Best regards,
    John
  24. Like
    JRys got a reaction from Rschell in QuickDAQ for measuring sound level   
    Hello,
    QuickDAQ does not have the ability to convert an mV signal from a microphone directly to dB. 
    I have a few notes about this and from what I picked up here and there this is how you get to dB.
    First, determine sound pressure using the following formula.

    Once you have sound pressure, use the following to get decibels:

    Where P = pressure in pascals
    Po = reference pascals (constant = 0.00002 Pa)
    Let’s say the average value from the microphone is 10mV. 
    I’m going to use the Sensitivity value of 450mV/Pa (PCB.com p/n 378A04).
    P = 0.010 / 0.450 = 0.022
    dB = 20 Log( 0.022 / 0.00002) = 60.82dB
    if you play with the numbers, 45dB is about 4mV. 
    I'm not a sound engineer so you should double-check this with the people at www.pcb.com.
     
    Best regards,
    John
     
  25. Like
    JRys got a reaction from Seth Slavin in Changing SYNC output on USB-1208FS-PLUS through internal A/D pacer clock change   
    Hello,
    The SYNC pin is dead until the AInScan function is called. After which it outputs the scan clock. To see it in action, set up a continuous acquisition at 20 sample/second and test the pin. If you're testing it by touching a scope probe to the screw terminal top, make sure to screw all the way down to make connection.
    Best regards,
    John
×
×
  • Create New...