Skip to content

dataq-instruments/Matlab-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matlab Example

Windows PC and Mac Matlab example for DI-188, DI-1100, DI-1110, DI-1120, DI_2008, DI-2108, DI-4108, DI-4208, DI-4718, and DI-4730, USB mode only

For DI-2008, make sure the firmware rev is at least 1.15

For DI-1100, DI-1110, DI-1120, DI-2008, DI-2108, DI-4108, DI-4208, DI-4718, and DI-4730, one must change the device from LibUSB mode (WinDaq capable, blinking green when idle) to CDC mode (blinking yellow when idle) first.

-How to change the device from LibUSB mode to CDC mode
  1. If your device is DI-188, skip the rest, it is always in CDC mode

  2. Connect the device to computer

  3. If the device blinks yellow, skip the rest, it is already in CDC mode

  4. If your device is DI-2008, skip to Step 8

  5. Once you see the blinking green light blinking, immediately push and hold the button

  6. Wait until the LED turns white then red

  7. Release the button and the device will be switched to CDC mode, and blinks yellow. Skip to 10

  8. The following step is for DI-2008 only

  9. When you see DI-2008 blinks green, press and release the button at 1 hz rate, until DI-2008 switch to CDC mode, and blinks yellow.

  10. Repeat the above operation if you need to switch back to LibUSB mode

+To run the example, you need to locate the COM port the device is connected to. For USB device, the baudrate is not important

For PC:

  1. Open Windows->Control Panel->Device Manager and find find the COM port listed under Ports (COM & LPT), in the screen capture below, 2108 is on COM 4
    alt text

  2. Since DI-188 uses Windows' generic CDC driver, it will not be listed with DATAQ DI-188 label. You can confirm its port by removing then re-plugging in DI-188 and watch the changes of COM port list under Windows->Control Panel->Device Manager.

For Mac:

  1. Don't plug in the Dataq device

  2. At Matlab prompt under command window (looks like >>), type seriealportlist and press enter, this will show the existing ports:
    alt text

  3. Plug the Dataq device into the USB port (make sure it is in CDC mode!) and issue the same command
    alt text

  4. You will see two more devices appear in the list. Choose one of them (in my case I used /dev/tty.usbmodemFA131) as the port. I think either one (tty or cu) works. Unfortunately, it does not show the entire detail (cuts FA131 out). To see that, you can bring up the Workspace tab by clicking on it:
    alt text

  1. Double click on the “ans” variable to see the four ports (adjust column width):
    alt text

  2. Once you locate the correct COM port and modify the Matlab program accordingly, you can run the program.

Test Drive

  • Below is the capture of a test run
    alt text

Extra Notes

About

Matlab example for DI-188, DI-2008, DI-1100, DI-2108, DI-4xxx (Windows and MAC)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages