11-20-2006 01:23 PM
11-20-2006 01:42 PM - edited 11-20-2006 01:42 PM
I'm not sure I understand why you want you use all of these different file i/o functions. If you just want to convert a string to SGL, then the type cast should be all that you need. Be sure to use a SGL constant datatype as the value that you wire into the type input.
Message Edited by Dennis Knutson on 11-20-2006 12:43 PM
11-20-2006 02:25 PM
Hi --
I found the type cast function, but I still am not sure how to go about recording the SGL output in a form that I can manipulate in Excel or Origin. I'd like to save the data out as a text file or in a spreadsheet which is why I had tried various File I/O VIs.
Thanks,
Michelle
11-20-2006 02:45 PM
11-20-2006 03:07 PM
Thanks for your patience. I think I am very close to getting this to work, but now it is only recording the first data point. I wired the output of the type cast VI to the Write to Spreadsheet VI through the Build Array VI. It records the output to the specified file, but only the very first value.
Michelle
11-20-2006 03:35 PM
Well, you are wiring only a single value into the build array function. In order to write more than one value, you will have to acquire more than one before you write it. Or, everytime you run your VI, you append new data to the existing file. If you have your instrument i/o inside of a while loop, you can wire the SGL to the edge of the loop, right click on the exit tunnel and select Enable Indexing. then your Write to Spreadsheet would be outside the loop and you would do a single save.
11-20-2006 04:50 PM
Thank you for that suggestion, it worked very well. However, for some reason, the VI is now recording the number zero over and over, instead of the data. Recording the data in ASCII format (example attached) still works, so I think things are ok on the picoammeter side.
There is a 2 byte header (#0) in front of each reading, perhaps this is causing problems with the conversion to SGL?
I've attached a copy of the current version of the VI, in case that might shed light on things.
Michelle
11-20-2006 05:00 PM
I don't have 8.2 so I can't view the VI. Can you post an image of the diagram? Post it as a png or jpg please.
And yes, the header could be a problem. If you know the length is always 2 bytes, you could simply use String Subset to get the remainder. I suggest you create a numerical indicator on the front panel to check the conversion to SgL before you save to file. It will just make it easier to debug.
11-21-2006 08:38 AM
Hi,
Attached is a PNG image of the block diagram so far. I've added an indicator to the front panel so that I can see the SGL conversion as it is done. I've also tried to cut out the two byte header before each data value using the String Subset function, but I am still not getting reasonable data. It reads out about 9x10^-10 A for the data when the picoammeter is reading 5 microA. Am I wrong in thinking that setting the offset to 2 should remove the first two characters? (The header is #0 in ASCII characters).
Currently the program is set to read out the current value and the timestamp from the picoammeter. I thought that might be a problem, so I tried just retrieving the current value, but I got the same incorrect data values after the SGL conversion.
Michelle
11-21-2006 08:54 AM