Hello, I need to solve an easy problem... apparently. Briefly, I want to do something like an oscilloscope with Matlab, receiving a signal via USB. I have done all the previous steps: I have my USB working, I have check that the computer receives the right data, etc.
Now, the problem is how to get data with Matlab. It's a simple communication, with one direction (USB to PC, with bulk transfers - but I could change this type), and I just need to read that data, just 2 bytes of data received continuously (because it's a digital signal with 16 bits resolution).
Thanks for your help.

6 comentarios

Star Strider
Star Strider el 29 de Sept. de 2012
Since you probably do not have the Instrument Control Toolbox, I suggest you see the documentation for the core MATLAB serial objects. In my limited experience, you may need the documentation for the USB hardware in your data acquisition unit, since you have to tell MATLAB how to communicate with it. After that, you experiment.
Image Analyst
Image Analyst el 29 de Sept. de 2012
Please reconcile this: "I have check that the computer receives the right data" with this: " the problem is how to get data with Matlab". Exactly how is your computer receiving the data now, if it's not through MATLAB? Did you check it with some other program? Do you have the Data Acquisition Toolbox? You may not need that. I'm communicating with an MCC device just using base MATLAB and the Measurement Computing DLLs.
Star Strider
Star Strider el 29 de Sept. de 2012
His device probably came with its own software. I had a similar experience with a pulse-oximeter a few years ago. It took a bit of programming, but I finally got it to communicate with MATLAB in almost real time. (The device had its own high-resolution color LCD, very small but readable. When I plugged it in to the USB port for the first time, Windows found and installed the driver, so the interface itself wasn't a problem. The software the device came with only displayed its data on the monitor and wouldn't export anything at all, so I couldn't use it to generate files for offline analysis.)
What are the ‘Measurement Computing DLLs’? I never heard of them before. They seem worth knowing about.
Image Analyst
Image Analyst el 30 de Sept. de 2012
It's s company that makes all kinds of compact devices that connect to the computer via USB (or other methods) and do things like digital I/O, analog I/O, temperature measurement, ADC, DAC, etc. They're one of the supported vendors. See Vendors. I use their PMD-1024 USB device to detect switch closures on our light booths. So the user can just push a button on the light booth to snap a picture instead of having to interact with the computer. That way they can just put dozens of samples into the light booth and snap pictures without having to fiddle with the mouse and navigate the cursor over a "Take picture" button on some GUI. It really speeds things along. We have a pull up resistor on a pin on the device. When the user pushes the button, the pin shorts to ground. I poll the switch 20 times per second, and can check whether the pin is high or low (+5 volts or ground). See their web site for info: http://www.mccdaq.com/. It's pretty cool because it's easy and convenient. Like I said, I don't even need the Data Acquisition Toolbox to talk to the device.
Star Strider
Star Strider el 30 de Sept. de 2012
Thank you! I'll bookmark the Vendors links for it and their website.
It'd be nice if there was a way to generate a relatively low-priority interrupt rather than having to poll it. Maybe some day...
Walter Roberson
Walter Roberson el 30 de Sept. de 2012
Image Analyst -- you mean you develop those "4 pictures for $1" booths that are found in malls? ;-)

Iniciar sesión para comentar.

 Respuesta aceptada

Palito
Palito el 21 de Oct. de 2012

0 votos

Thanks everyone for the info. I am using a PSoC device, and I found an easy way to communicate with PC: making USB work as a COM port, so I can easyly process data with Matlab :)

Más respuestas (0)

Categorías

Más información sobre Data Acquisition Toolbox Supported Hardware en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 29 de Sept. de 2012

Comentada:

el 23 de Nov. de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by