TC-08, msdos program in C or C++

Post your C and C++ discussions here
Post Reply
Nicolas
Newbie
Posts: 0
Joined: Tue Aug 24, 2010 9:53 am

TC-08, msdos program in C or C++

Post by Nicolas »

Hi,

I need to run a program in C or C + + very easy for TC-08 without interfaces. In fact, I would like to use it with Matlab (or another program like it).

The idea is to have a program running with MsDos and returns the output value of termocouple I chose.

Thanks for your help!

Nicolas

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: TC-08, msdos program in C or C++

Post by Robin »

Hi

We have a C example in the SDK, which can be downloaded via www.picotech.com/software.html

Robin

Nicolas
Newbie
Posts: 0
Joined: Tue Aug 24, 2010 9:53 am

Re: TC-08, msdos program in C or C++

Post by Nicolas »

Hi,

With what program you should I compiled the C project. I tried to compile with Dev-C++, but it doesn't work.

I created a new project
I added the two files:
  • usb_tc08.c
  • usbtc08.h
Unfortunately, when I compile, I have several errors (upload attachement).

What can I do ?

Thank you,

Nicolas
Attachments
usb pico.gif
usb pico.gif (4.81 KiB) Viewed 10597 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: TC-08, msdos program in C or C++

Post by Robin »

Hi Nicolas

The example is a Windows example and will have been created in Visual Studio. You also need to include the resources in your project. The SDK includes both the resource script (.rc) and the compiled resource file (.res).

I don't know much about Dev-C++ and how easy it is to include the resource files.

The API is quite straightforward and you don't need to compile it to understand the calls, so you could just use the source as a guide for your console application.

Robin

Nicolas
Newbie
Posts: 0
Joined: Tue Aug 24, 2010 9:53 am

Re: TC-08, msdos program in C or C++

Post by Nicolas »

Hi,

The 4 files are added to the project.

I downloaded the latest version of Visual Studio Express 2010 (first attachment) :
  • Usbtc08.c
  • Usbtc08.rc
  • Usbtc08.res
  • Usbtc08.h
I still have the same errors :
1>c:\program files\pico technology\pico full\examples\usb tc08\usb_tc08.c(57): error C2061: erreur de syntaxe : identificateur 'WndProc'
1>c:\program files\pico technology\pico full\examples\usb tc08\usb_tc08.c(57): error C2059: erreur de syntaxe : ';'
1>c:\program files\pico technology\pico full\examples\usb tc08\usb_tc08.c(57): error C2059: erreur de syntaxe : 'type'
1>c:\program files\pico technology\pico full\examples\usb tc08\usb_tc08.c(134): error C2065: 'WndProc' : identificateur non déclaré
There's 4 errors and 14 warnings.

Is it possible to send me the complete projet file (Visual project + files) and give me the exact version of Visual your using.

Thank you for your help,

Nicolas
Attachments
Visual C.JPG
Visual C.JPG (26.85 KiB) Viewed 10593 times

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: TC-08, msdos program in C or C++

Post by Robin »

Hi

I have attached the full project that I just tested in Visual Studio 2005 Standard Edition.

Hope it helps

Robin
Attachments
USBTC08.zip
(8.73 KiB) Downloaded 581 times

Nicolas
Newbie
Posts: 0
Joined: Tue Aug 24, 2010 9:53 am

Re: TC-08, msdos program in C or C++

Post by Nicolas »

Hi,

Thank you. It is possible now to have the values of temperatures of my TC08.

What I want to do is to execute my C program (with a trigger) and save my data with Matlab each 0.5 s, for example. But one execution of my new program during more than 1.5s, which is too long.

Is it possible to create 3 programs (exe) like this
  1. Open TC08 (drivers) (at the end pico is still open)
  2. Many times I can have my temperatures
  3. Close TC08
The idea is to not open all drivers each time I want a temperature.

Have you got an idea to solve my problem ?

Thank you,

Nicolas

Robin
Advanced User
Advanced User
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: TC-08, msdos program in C or C++

Post by Robin »

Hi

You can't have multiple programs accessing the TC-08 at the same time.

Also, remember that the conversion time for the TC-08 is 100 ms plus 100 ms for each enabled channel. So if you have all 8 channels enabled, it will take 900 ms.

The C example uses usb_tc08_get_single. For faster sampling, you should use streaming mode. See section 3.2.2 of the manual. In streaming mode, the driver continually streams data to its internal buffer and you can get data from this buffer periodically using usb_tc08_get_temp

Robin

Post Reply