MATLAB and usb tc-08

 
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
Author Message
jansonr
Active User
Active User


Joined: 26 Nov 2004
Posts: 7

PostPosted: Wed Sep 28, 2005 2:53 pm    Post subject: MATLAB and usb tc-08 Reply with quote

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
Back to top
Michael
Guru
Guru


Joined: 07 Jul 2005
Posts: 93
Location: St Neots, Cambridgeshire

PostPosted: Thu Sep 29, 2005 8:52 am    Post subject: Reply with quote

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
Back to top
jansonr
Active User
Active User


Joined: 26 Nov 2004
Posts: 7

PostPosted: Mon Oct 03, 2005 2:33 pm    Post subject: drivers Reply with quote

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
Back to top
Paul76
User
User


Joined: 11 May 2006
Posts: 3
Location: Switzerland

PostPosted: Thu May 11, 2006 1:45 pm    Post subject: Reply with quote

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
Back to top
jansonr
Active User
Active User


Joined: 26 Nov 2004
Posts: 7

PostPosted: Thu May 11, 2006 2:13 pm    Post subject: Reply with quote

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
Back to top
Paul76
User
User


Joined: 11 May 2006
Posts: 3
Location: Switzerland

PostPosted: Fri May 12, 2006 7:33 am    Post subject: Reply with quote

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
Back to top
jansonr
Active User
Active User


Joined: 26 Nov 2004
Posts: 7

PostPosted: Fri May 12, 2006 10:26 am    Post subject: matlab Reply with quote

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
Back to top
Michael
Guru
Guru


Joined: 07 Jul 2005
Posts: 93
Location: St Neots, Cambridgeshire

PostPosted: Mon May 15, 2006 9:04 am    Post subject: Reply with quote

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
Back to top
Sarah
Guest





PostPosted: Mon May 22, 2006 12:32 pm    Post subject: Reply with quote

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
Back to top
Guest






PostPosted: Tue Mar 18, 2008 11:28 am    Post subject: Example Code for TC-08 USB in Matlab Reply with quote

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
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 87
Location: Garden City, KS USA

PostPosted: Tue Mar 25, 2008 10:30 pm    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> General Software Discussions
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group