MATLAB and usb tc-08

Post your MATLAB discussions here
Post Reply
jansonr
User
User
Posts: 7
Joined: Fri Nov 26, 2004 4:02 pm

MATLAB and usb tc-08

Post by jansonr »

I know you don't officially support MatLab, but I'm trying to write code to control the USB tc-08 in streaming mode but cannot get it to work properly.

Do you have ANY examples you could show me that might give me a hint (or does anybody have any MatLab code that might help me?)

Also could you give me more of an indication what values the dll requires and what it is supposed to return? I have read the manual over and over and it doesn't seem to give much information and seems to contradict the dll code.

Any more help anybody can give me would be appreciated - I've tried everything I can think of yet still can't get this to work!

Thanks,

Rob

Michael
Advanced User
Advanced User
Posts: 656
Joined: Thu Jul 07, 2005 12:41 pm
Location: St Neots, Cambridgeshire

Post by Michael »

Hello,

Thank you for your post.

Our help files provide all the information about the dll function calls.

Has anybody out there created a MATLAB example they would like to share?

Best regards,
Michael
Michael - Tech Support
Pico Technology
Web Support Forum

jansonr
User
User
Posts: 7
Joined: Fri Nov 26, 2004 4:02 pm

drivers

Post by jansonr »

I heard on the forum that you have drivers/matlab examples for at least one of your other products (although I forget which one).

Could you send me these files so I could get a better picture about how the code should look?

Thanks,

Rob

Paul76
User
User
Posts: 3
Joined: Thu May 11, 2006 1:36 pm
Location: Switzerland

Post by Paul76 »

Hi Rob,

Have you found a code to read the TC-08 (USB) directly in Matlab in streaming mode in the meanwhile?
Would be nice if you could send it to me or post it here.

Thanks,

Paul

jansonr
User
User
Posts: 7
Joined: Fri Nov 26, 2004 4:02 pm

Post by jansonr »

Hi,

I could get the tc-08 to do everything but stream the data, but every time I tried to read from it MatLab would crash. I haven't really used the system since as I've been working on other things however, so haven't tried much more.

If you get anywhere with it I would like to see how you did it too. If you are having problems getting MatLab to talk to the sampler then I can dig out my old code that used to work for setting up the channels and starting sampling etc.

Rob

Paul76
User
User
Posts: 3
Joined: Thu May 11, 2006 1:36 pm
Location: Switzerland

Post by Paul76 »

Hi Rob,

Would really appreciate if you could post or send me the code for setting up the TC-08.
Have you worked with MEX and used the given c-code?

Paul

jansonr
User
User
Posts: 7
Joined: Fri Nov 26, 2004 4:02 pm

matlab

Post by jansonr »

I used the support for .dlls in MatLab 7. To be honest I'm not much of a programmer and have very limited knowledge of C, so found it tough trying to work out what was going on. Also when I was doing the work the dll support in MatLab was almost non-existant as it's a new feature.

I'll have a dig round and see if I can find the code for you though if it will be any help.

Rob

Michael
Advanced User
Advanced User
Posts: 656
Joined: Thu Jul 07, 2005 12:41 pm
Location: St Neots, Cambridgeshire

Post by Michael »

Hello,

YOu can find the function information in the manual for the TC08. Please read this as there is valuable information here!

Best regards,
Michael
Michael - Tech Support
Pico Technology
Web Support Forum

Sarah

Post by Sarah »

Hi

Just as an aside, the MatLab example we have is for the ADC-2xx range and it was written by another customer. If anyone would like this please email us at tech@picotech.com and we will send it to you.

Best Regards

Guest

Example Code for TC-08 USB in Matlab

Post by Guest »

Here is some code that works with the TC-08 USB under MATLAB Version 7.4.0.287 (R2007a)

its not pretty but it works...

don't forget to change the directories for the correct location of your files!

---start here---
if ~libisloaded('usbtc08')
disp('Matlab: Load usbtc08.dll')
loadlibrary('C:\TC08\usbtc08.dll','C:\TC08\usbtc08.h')
disp('Matlab: dll loaded')
disp('')
else
disp('Matlab: dll already loaded')
disp('')

end


htemp=calllib('usbtc08', 'usb_tc08_open_unit') % open communication with TC-08

ok=calllib('usbtc08','usb_tc08_set_channel', htemp,int16(1),int8('T')) %setup a single channel

%-------------------------------------------------------------------------
x=single(3);
y=int16(3);
xp = libpointer('voidPtr',x);
yp = libpointer('voidPtr',y);
for loop =1:100
[a,data(loop),cthing]=calllib('usbtc08','usb_tc08_get_single',htemp, xp,yp, 0);
pause(0.01)
end
%-------------------------------------------------------------------------

ok=calllib('usbtc08','usb_tc08_close_unit',htemp);%close comms with TC-08

gruntman
Advanced User
Advanced User
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Post by gruntman »

Hello,

Thank you for posting this! I'm sure our customers are very appreciative of you doing this for the Pico Community!

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com

Guest

Post by Guest »

Hello

I try Guest's matlab code for the usb tc08 data logger but it didn't work with MATLAB R2008a.

Thanks for your help.

eblues
Newbie
Posts: 0
Joined: Mon Mar 29, 2010 2:57 pm

Re: MATLAB and usb tc-08

Post by eblues »

Hello to everyone! I created a GUI to control the USB-tc08. This program is not perfect and it has the comments in Italian, but it works. I attach it in case it could be useful to someone.
Regards.
Attachments
Pico_tc08.rar
(59.8 KiB) Downloaded 1144 times

shnteb001
Newbie
Posts: 0
Joined: Fri Sep 17, 2010 9:32 am

Re: MATLAB and usb tc-08

Post by shnteb001 »

anyone figured the code for a serial TC-08

Post Reply