Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

New Matlab class for U6 Exodriver (OS X / Linux)


  • Please log in to reply
10 replies to this topic

#1 mhopeng

mhopeng
  • Members
  • 7 posts

Posted 15 August 2012 - 01:37 AM

I put together a class definition file for working with the analog functions of a U6 in Matlab using the Exodriver. It includes the analog functions: analog read, analog streaming, and analog output. You can download it from the FileExchange:

http://www.mathworks...eexchange/37814

I developed it on Mac OS X with Matlab R2012, but it should work with Linux and with earlier versions of Matlab, as long as the Exodriver is installed. It's version 1, and only tested by the author, so it probably has some "unexpected features". I'd be interested in your feedback if you try it out.

Note: user Iandol previously did a similar project for the digital functions of the U6; between the two files most of the device functionality is covered.

#2 Iandol

Iandol
  • Members
  • 46 posts

Posted 17 August 2012 - 02:36 AM

I put together a class definition file for working with the analog functions of a U6 in Matlab using the Exodriver. It includes the analog functions: analog read, analog streaming, and analog output. You can download it from the FileExchange:

http://www.mathworks...eexchange/37814

I developed it on Mac OS X with Matlab R2012, but it should work with Linux and with earlier versions of Matlab, as long as the Exodriver is installed. It's version 1, and only tested by the author, so it probably has some "unexpected features". I'd be interested in your feedback if you try it out.

Note: user Iandol previously did a similar project for the digital functions of the U6; between the two files most of the device functionality is covered.


Great news, will have a look when I get time and perhaps we can create a unified class at some point! I assume it will also work for the U3 (haven't checked if the low-level functions are the same for analog, suspect they are except for dealing with calibration defaults etc.)?

#3 mhopeng

mhopeng
  • Members
  • 7 posts

Posted 20 August 2012 - 05:44 AM

Yes, I think a combined class would be pretty straightforward to do. I've used up my "unpaid project time" for the summer :) but if there is some good user feedback, I'd consider working on this later in the year. I don't have a U3 to test with, so I'm not sure about the compatibility, but a quick glance at the user guide suggests that the firmware interface is very similar if not identical (maybe LabJack support can comment?). You would just have to change the deviceID property to 3 to test this in matlab.

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 20 August 2012 - 12:40 PM

The U3 and U6 low-level functions are similar, and in some cases identical. Some differences are that the the U6 does not have lines that can switch between analog and digital (FIO/EIOAnalog), analog related settings are a little different, different calibration constants, the U3 has only 2 timers, etc. For a comparison between devices (not mentioning low-level functions), take a look here on our site:

http://labjack.com/products/comparison

#5 StellenboschStudent

StellenboschStudent
  • Members
  • 3 posts

Posted 02 October 2012 - 09:06 AM

What do I need to install in order to het this running? LJFuse?

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 02 October 2012 - 01:14 PM

You need MATLAB and the Exodriver installed. LJFuse is not required. mhopeng provided a MATLAB U6 class definition.

#7 mhopeng

mhopeng
  • Members
  • 7 posts

Posted 16 October 2012 - 09:22 AM

You need MATLAB and the Exodriver installed. LJFuse is not required. mhopeng provided a MATLAB U6 class definition.

This is correct. On OS X, you will also need to install Xcode (or just the command-line tools) in order to compile and use the Exodriver with matlab. See this matlab support page for details:

http://www.mathworks.../data/1-FR6LXJ/

#8 Sergiy

Sergiy
  • Members
  • 5 posts

Posted 15 June 2013 - 08:47 AM

Would this class work for UE9?

#9 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 17 June 2013 - 10:09 AM

It doesn't look like it will work without modification. In terms of the Exodriver (our Mac OS X driver), the find and open calls would need to be changed for a UE9 and low-level functions would need to be changed to UE9 ones. The class is a helpful starting point as it shows how to use the Exodriver in MATLAB ("loadlibrary", "calllib('liblabjackusb', ... )" calls) and provides some useful functions that calculate checksums, etc..

In the Exodriver source code download, take a look at the C examples for UE9 and Exodriver usage and examples (examples/UE9) and the header file (liblabjackusb/labjackusb.h) for the Exodriver functions' documentation:

https://github.com/labjack/exodriver

Take a look here for UE9 low-level function (command/response packets) documentation:

http://labjack.com/s...9/users-guide/5

Also, on a UE9 you can use TCP for communications instead of the Exodriver and use low-level functions.

#10 Sergiy

Sergiy
  • Members
  • 5 posts

Posted 19 June 2013 - 11:13 AM

Thank you. If there is a reference to the ethernet Matlab code, I would very much appreciate it. We are trying to put together an acquisition package in Matlab using LabJack.

#11 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 19 June 2013 - 12:28 PM

We do not have any MATLAB ethernet code, but this should help get you started:

http://www.mathworks...-interface.html

Our general TCP low-level C examples are here:

http://labjack.com/s...ive-tcp-example

Setting up the low-level command arrays/packets and getting data out of the response arrays/packet should be the same or similar to what's in the U6 class except for using TCP open/write/read/close and UE9 specific low-level functions instead. The normal TCP port is 52360 and the stream port is 52361. You will want to write/read binary data, and set the fwrite/fread precision to 'uchar' or 'uint8' (not sure which would be better).


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users