Jump to content
  • 0

Matlab with USB-2408, error message: Timeout expired before operation could complete.


yoonengineer

Question

Hello all,

I am tyring to use USB-2408 with Matlab. I just copied the following code from MathWork website.

image.png.2b6258ea67eaad34125a0965a20e2ac6.png 

 

Then, Matlab displays as follows with an error message "Timeout expired before operation could complete.". I extended the seconds(1) to seconds(60), however, I got the same error message. I've searched/googled to find the solution, however, I could not find any useful information.

Would you help to me fix this problem?

image.thumb.png.d8f2e11019a79d8e53b49a7d525815ec.png

image.thumb.png.161faf1bb39fc47081132106017b4b99.png

 

 

 

Edited by yoonengineer
Link to comment
Share on other sites

17 answers to this question

Recommended Posts

  • 0

Hello @yoonengineer.

With your USB-2408 connected to your Windows system, close MATLAB and open MCC's InstaCal.  Which version of InstaCal do you have installed?  Verify the USB-2408 has its analog input channels configured for voltage.

image.png

 

Afterwards, close InstaCal and open MATLAB.  Re-enter the same lines of code in MATLAB's Command Windows.

image.png

image.png

image.png

image.png

 

If you continue to have an issue, enter 'ver' in the Command Window and send me the results.  (Note: Remove your MATLAB License Number before posting.)  Also, send me a screen capture of MATLAB's Add-On Manager; see my list below.

 

image.png

 

Also, reply with your results for 'daq.getVendors', as shown below.

image.png

 

Regards,

Fausto

Link to comment
Share on other sites

  • 0

Thank you very much for your response.

The current version of Instacal is 6.60. It is a bit complicated how I installed Instacal. I downloaded the support package from MathWork website and installed it. It is ver. 6.60. The problem was that it did not detect the USB-2408. So, I uninstalled it. Then, I downloaded from mccdaq.com and installed ver. 6.74. Then, I opened "C:\Program Files (x86)\Measurement Computing\DAQ" and copied the following files. After that, I uninstalled ver. 6.74 and re-installed 6.60, which I downloaded from MathWork website. Then, I pasted the following files to "C:\Program Files (x86)\Measurement Computing\DAQ". Then, it was able to detect the USB-2408.

 

* The files that copied and pasted.

ICalHelp.chm
logo.bmp
ReadMe.txt
ReadMeUL.txt
ULHelp.chm
ulprops.txt

 

 

image.thumb.png.6b0507005f0ff3288b02f7b8e410d25b.png

 

image.thumb.png.f65f40a2fe11834392dd2960d78c6906.png

 

image.thumb.png.aea5d2a614f48badbb592cd1eb692700.png

 

image.thumb.png.1672820fd0486d7af50aecede934f75a.png

 

 

Link to comment
Share on other sites

  • 0

@yoonengineer,

Thank you for the screen captures and additional information.

Please close MATLAB and install the current version of InstaCal using the MCC DAQ Software installer.

https://www.mccdaq.com/Software-Downloads

Launch InstaCal to confirm detection of the USB-2408 and to verify the channel configurations are set to 'voltage'.  (Note: Temperature measurements via MCC devices are not supported in MATLAB.)  Afterwards, close InstaCal and launch MATLAB to run your code.

Regards,

Fausto

Link to comment
Share on other sites

  • 0

I followed your instruction. If I open InstaCal, I can see USB-2408 as follows.

image.thumb.png.250f0d84a09959c4e2ebe09114dc8773.png

 

 

However, I got an error message as follows if I run the code in Matlab.

image.png.74a5144946c894628aae2780f9609476.png

 

If I type the "v=daq.getVendors" in the command window, I got the following message.

 

image.thumb.png.3d86b6053ecadb41fef547d4badec72c.png

 

image.thumb.png.dd2f6b0d523ea0aaa24fc5038158ee25.png

Link to comment
Share on other sites

  • 0
21 hours ago, Fausto said:

@yoonengineer,

Thank you for the screen captures and additional information.

Please close MATLAB and install the current version of InstaCal using the MCC DAQ Software installer.

https://www.mccdaq.com/Software-Downloads

Launch InstaCal to confirm detection of the USB-2408 and to verify the channel configurations are set to 'voltage'.  (Note: Temperature measurements via MCC devices are not supported in MATLAB.)  Afterwards, close InstaCal and launch MATLAB to run your code.

Regards,

Fausto

Would you inform how you installed InstaCal ver. 6.74? I am confused because ver. 6.74 is not suppored by MathWork.

Link to comment
Share on other sites

  • 0

Hello @yoonengineer.

Thank you for the screen captures.

Please restart your Windows 11 system and then open your MATLAB R2023a release.  Click on the 'Add-Ons' menu option and select 'Manage Add-Ons'.  Does the list show the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware'?

image.png

 

If the Measurement Computing support package is listed, then please uninstall the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware' from the Add-On manager.  To uninstall the package, click on the vertical ellipsis at the far right and select 'Uninstall'.

 

image.png

 

Afterwards, close MATLAB.  Next, using Windows Control Panel - Programs and Features (use 'appwiz.cpl' from Windows Taskbar search field), uninstall Measurement Computing Corporation's 'InstaCal and Universal Library for Windows'.  Restart your computer and then go back into MATLAB.  Reinstall the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware' via MATLAB's Add-On manager.  During the package's installation, MATLAB should install MCC’s drivers and libraries (v6.60.0 at the time of this post).  Let me know if this step does not happen.  Next, exit MATLAB.  Connect your USB-2408 device and launch InstaCal.  Verify that the device appears in the list, the channels are configured as voltage types, and then close InstaCal.  Launch MATLAB and run 'daqvendorlist' in the Command Window, followed by 'daq.getDevices' and 'daq.getVendors'.  Does MATLAB detect the MCC vendor and your hardware?  Please respond whether these steps were successful or not.  

Regards,

Fausto

-------------- 

File Exchange location for the Data Acquisition Toolbox Support Package for Measurement Computing Hardware:

https://www.mathworks.com/matlabcentral/fileexchange/61373-data-acquisition-toolbox-support-package-for-measurement-computing-hardware

Link to comment
Share on other sites

  • 0

I found this instruction before I asked. I did this steps several times, but didn't work. The problem is that it installs ver. 6.60, and it did not detect the device. Would you inform how I can upgrade to ver. 6.74 after installing 6.60?

Edited by yoonengineer
Link to comment
Share on other sites

  • 0
1 hour ago, Fausto said:

Hello @yoonengineer.

Thank you for the screen captures.

Please restart your Windows 11 system and then open your MATLAB R2023a release.  Click on the 'Add-Ons' menu option and select 'Manage Add-Ons'.  Does the list show the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware'?

image.png

 

If the Measurement Computing support package is listed, then please uninstall the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware' from the Add-On manager.  To uninstall the package, click on the vertical ellipsis at the far right and select 'Uninstall'.

 

image.png

 

Afterwards, close MATLAB.  Next, using Windows Control Panel - Programs and Features (use 'appwiz.cpl' from Windows Taskbar search field), uninstall Measurement Computing Corporation's 'InstaCal and Universal Library for Windows'.  Restart your computer and then go back into MATLAB.  Reinstall the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware' via MATLAB's Add-On manager.  During the package's installation, MATLAB should install MCC’s drivers and libraries (v6.60.0 at the time of this post).  Let me know if this step does not happen.  Next, exit MATLAB.  Connect your USB-2408 device and launch InstaCal.  Verify that the device appears in the list, the channels are configured as voltage types, and then close InstaCal.  Launch MATLAB and run 'daqvendorlist' in the Command Window, followed by 'daq.getDevices' and 'daq.getVendors'.  Does MATLAB detect the MCC vendor and your hardware?  Please respond whether these steps were successful or not.  

Regards,

Fausto

-------------- 

File Exchange location for the Data Acquisition Toolbox Support Package for Measurement Computing Hardware:

https://www.mathworks.com/matlabcentral/fileexchange/61373-data-acquisition-toolbox-support-package-for-measurement-computing-hardware

Would you inform me how you installed or upgraded to ver. 6.74?

Link to comment
Share on other sites

  • 0

After installing Instacal 6.60 and connecting USB-2408, if I open Instacal, it does not detect the device. Do you have any idea how to make it detected? 

 

If I upgrade to 6.74, it detects the device. However, if I run "[data, startTime] = read(dq, seconds(1));", I got "Timeout expired before operation could complete" as shown as follows.

image.thumb.png.290e8d0c308dab1d932f76ea8c1704b9.png

Edited by yoonengineer
Link to comment
Share on other sites

  • 0

Hello @yoonengineer.

Restart your Windows target system and then launch MATLAB.  Please uninstall the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware' using the Add-On manager.  To uninstall the package, click on the vertical ellipsis at the far right and select 'Uninstall'.

image.png

 

Afterwards, exit MATLAB.  Using Windows Control Panel - Programs and Features, uninstall 'InstaCal and Universal Library for Windows'. 

image.png

 

Restart your system and then go back into MATLAB.  Use the Add-On manager to search for the 'Data Acquisition Toolbox Support Package for Measurement Computing Hardware'.  Click on the 'Install' pull-down option and select 'Install'.

image.png


After installing the support package, close MATLAB.  Download the current version of the MCC DAQ Software and install it on your system.

https://www.mccdaq.com/Software-Downloads

Next, connect (or cycle the USB connection to) your USB-2408 to the target system.  Launch InstaCal.  Go to HELP - ABOUT to confirm that it is the latest version.  Close the ABOUT window.  The USB-2408 should have been detected and should appear in the list.  Verify the channel configurations are set to 'voltage'.  (Note: Temperature measurements via MCC devices are not supported in MATLAB.)  Afterwards, close InstaCal and launch MATLAB to confirm the 'mcc' vendor is operational ('true') and the USB-2408 appears with the daqlist (or with daq.getDevices) command.

image.png

 

image.png

 

Lastly, run your code.

Regards,

Fausto

https://www.mathworks.com/matlabcentral/fileexchange/61373-data-acquisition-toolbox-support-package-for-measurement-computing-hardware

image.png

Link to comment
Share on other sites

  • 0

I found the problem. I changed dq.Rate to lower, then, it worked.

Thank you very much for your help.

 

Would you mind if I ask you several more questions.

1. Would you provide any example of Matlab code that measures voltages from multiple channels? The current example code provided in MathWorks website only gets data from one channel.

2. I want to measure temperature, not voltage. If this does not measure temperature via Matlab, would you inform how I can calculate the temperature from the voltage measurement?

3. Would you inform me how I can get Reference Junction Temperature when measuring voltage, then, maybe I can calculate temperature out of the voltage measurement?

Edited by yoonengineer
Link to comment
Share on other sites

  • 0

@yoonengineer,

The status code: -226 error was unrelated to your daq rate settings.  Glad you resolved both issues.

In the code you provided initially, you added one analog input channel only.  To add additional analog input voltage channels, repeat the 'addinput ()' command.

As mentioned previously, temperature measurements via MCC devices are not supported in MATLAB, nor does a user have access to the CJC reference temperature.

Regards,

Fausto

image.png

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...