Test and Measurement Forum

Trouble Reading Output File

Having problems ? let us know the details here

Trouble Reading Output File

Postby Cbeddoe » Tue Apr 23, 2013 2:13 pm

Hi,

I'm running windows 7 on a 64 bit, Intel i7 PC.

I am looking to collect data from a PT-104 Temperature Logger using a simple Java Program.
(running 32 bit Java, using 32 bit Eclipse IDE)
Ideally, I would use JNI to create a wrapper for the supplied C libraries, but I don't have any experience doing that yet.
- If someone could point me towards some good examples I would greatly appreciate it

In the short term, in order to get things up and running I thought I could simply monitor the Data File created by the PicoLog Program.
- This is something I have done frequently with other applications just to get things moving forward until I can directly interface with the equipment.

I have tried reading both the .prn and .txt output files and have run into the same issue.
- The PicoLog program stops writing to the file after I read it for the first time.
- It doesn't throw any errors it just stops writing to the file.
- I can set the PicoLog program up to start logging data again by overwriting the existing save file (using the spreadsheet display)


I am also encountering the Fatal Error 251 when using the PT-104 normally.
I have read this error is a result of an issue with not being installed on the admin account which I hope to get resolved in the next few days.

Has anyone else run into issues monitoring a PicoLog data file with an external program while it is being logged to?
Can anyone suggest a quick work around?
Could this problem be related to the Admin account issues?
My next best bet is to try my hand at C programming which I don't have much experience with yet.

Any help would be greatly appreciated,


Chris
Cbeddoe
Newbie
 
Posts: 0
Joined: Mon Apr 22, 2013 7:52 pm

Re: Trouble Reading Output File

Postby Hitesh » Tue Apr 23, 2013 2:30 pm

Hi Chris,

There is an example of using JNI to create a wrapper dll for our PicoScope 2000 series devices in the Java area of the Forum:

http://www.picotech.com/support/forum53.html

If you need any help with this please post in the Java Forum area.

With regards to the accessing the file it is not possible to do this while the data file is being written to. You can export the resulting data file to a .txt or .csv for post-processing.

It is possible to use MS Excel with Microsoft DDE to display live data from PicoLog in a spreadsheet but I'm not sure if you can use Java to access these fields.

How long are you looking to capture data for?

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 1999
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Trouble Reading Output File

Postby Cbeddoe » Tue Apr 23, 2013 6:19 pm

Hi Hitesh,

Thanks for the quick response!
I'll take a look at the other forum area you listed for using the JNI wrapper.

For my application I may be monitoring temperatures for intervals from 30 minutes up to a month or more depending on the specific requirements.
I would prefer to take temperature measurements every 1-5 seconds depending on test duration.


Typically, it only takes about <1-4 ms for a program to append a data file and about <1 ms for me to detect and pick up the data.

So, as long as the application doesn't require obscenely accurate timing, I can get away with a quick Cross Platform Java GUI and supplied instrument software.

This usually allows me to get things up and running for an experiment very quickly for shakedown testing while I polish out a more robust program for directly interfacing with measurement sources.

It's unfortunate that I won't be able to get at the data the easy way with the PT-104.
- Do you know, is that issue specific to the way files are output in the PicoLog Program or does it have more to do with the requirements for writing files in C? - just something for me to pay attention to in the future.
- I've been lucky enough to get away with monitoring data files for slow data sources quite a few times. I suppose it was only a matter of time before I ran into a problem with it somewhere

I tried the provided excel example. But of course, I have 64 bit Excel so it threw an error on the 32 bit library references.
I have some experience with VB in Excel, and I know I can monitor data files generated with Excel.
I should be able to get that to work quickly if I can install a 32 bit version of Excel.



Thanks Again,

Chris
Cbeddoe
Newbie
 
Posts: 0
Joined: Mon Apr 22, 2013 7:52 pm

Re: Trouble Reading Output File

Postby Hitesh » Wed Apr 24, 2013 8:40 am

Hi Chris,

The file issue is possibly something with Windows file handling but it's better to err on the side of caution to avoid the possibility of a corrupt data file.

The current SDK should contain a 64-bit dll that you can use with a 64-bit version of Excel. You will need to use the PtrSafe keyword in the Function declarations.

E.g.

Code: Select all
Declare PtrSafe Function UsbPt104OpenUnit Lib "UsbPT104.dll" (ByRef handle As Integer, ByVal serial As Integer) As Integer


Note that you will have to change Long data types to an Integer data type for the function declarations.

Hope this helps.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 1999
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 0 guests