09-25-2008 04:49 PM
Hi, I have developed a pretty basic LabView program to take two sets of photon counts one passing through a cell, and one not and then work out the absorbance in the cell.
I am using a Stamford Research SR400 photon counter connected via GPIB USB interface. Currently my programme is set up to perform a set number of photon counts, and then dump it all to a table and 3 graphs (one for channel A, one for channel B and one calculating the absorbance). I ideally would like these to display in realtime as the data is being collected, is there anyway of doing this? I have tried several things and can't get it to update in realtime so I'm wondering is this because I don't know what I'm doing in LabView, or an issue with the GPIB read/write timing or the photon counter? If anyone could offer some help I'd be very greatful.
I am using LabView 7 Express and my code is attached. Thanks
09-25-2008 05:26 PM
You must really love sequence frames.
In order to see the data as it's collected you need to put the graphs inside the for-loop where it's being collected. As it is, dataflow dictates that the graph won't diplay any data until the loop is finished. If you want to use XY graphs then you need to use a shift register to populate the array that's fed to the XY graph.
You also seem to have parts of your code cased out, but use constants. Is there a reason for this? Also, is there a specific reason you're using the old GPIB functions as opposed to VISA?
09-25-2008 06:44 PM
Ha yes, I can only follow what I'm doing in sequence frames! It helps me understand how things flow/are connected. I have very limited knowledge of labview and basically have things the way I have them because that's the only way i could get it to work. I had loads of problems initially with timing, getting maybe only every 5th photon count put into labview etc which I think is why I have the constants. I am not really familiar at all with VISA so used the GPIB as I figured that would be what I needed as I am reading and writing to/from GPIB? I will try putting all of my plots into the for loop and changing to shift registers, hopefully without deleteing all of my existing code or something!!
Thanks very much I am slowly hopefully getting the hang of this!
09-26-2008 01:23 PM
okey, dokey. If you run into problems, just post back.
FYI: VISA is an API that includes GPIB, serial, and TCP/IP. You can get a high-level overview here: http://zone.ni.com/devzone/cda/tut/p/id/3702
09-26-2008 03:50 PM
Hi,
I have changed my code as suggested and now have it so there are no errors, however rather than building up a realtime display of each photon count as it is collected, the loop collects one photon count then overwrites it with the next etc. Also the loop doesn't seem to ever stop after the specified number of photon counts has been performed. I think that this is probably something to do with the shift registers as I am not very familiar with these, and from what i have read I need to tell these somehow to move on and collect a second poin etc?
I have attached my "new" code, if you wouldn't mind having a look to see if you can spot my error I'd be most greatful
Thanks for all of your help!
09-26-2008 04:38 PM - edited 09-26-2008 04:42 PM
Yeah, that's not quite right. The shift register are for your arrays, not for the numeric, which doesn't do anything. Here's a quick example (I can't backsave to 7.0):
As I pointed out before, this method will have a memory impact because you're constantly building arrays. A better method is to use Replace Array Subset like this:
09-26-2008 04:49 PM - edited 09-26-2008 04:50 PM
Ahh, Ok.
I'll give that a go...and I thought I was getting the hang of this!
Cheers
09-26-2008 06:26 PM
Ok, I have done what i thoght you meant for me to do, but now the photon counter performs x amount of counts and then once it has finished counting it plots them out for you, ie you see the plot being built rather than just getting the final plot dumped on screen, but it still happens after all of the data has been collected. Is it possible that the photon counter only dumps all of it's values to the GPIB after it has finished counting, or have I just done something wrong?
Sorry for all of the hassle, I do realise how incompetant I am and how annoying it must be to somebody who understands these things!
Cheers
09-27-2008 11:37 AM
Unfortunately, that's not right at all. You've seem to have take an incorrect left turn somewhere. In the sample code I posted you see there's a random number generator. This was supposed to be what you get out of the last GPIB Read, as that was the value you wanted. The output of the GPIB Read is the value that you put into the array that gets passed around the shift register. You weren't supposed to duplicate the code exactly. You should have only one loop, not 4.
Also:
09-29-2008 06:38 PM
Hi, sorry, I'm not sure where my head was last Friday, or today come to think about it. Throughout the day I have made a series of stupid mistakes. I now have code which I think (yet again!) is right. This time the code runs fine, and I get realtime output for each channel for about 8 or 9 photon counts, and then it is as if the whole system gets bogged down and it stops displaying any of the data. I had a similar problems when I initially started to construct this code, something to do with emptying and clearing the buffers, which is what resulted in all of the wait times in each frame. It did not seem to matter whether those occurred before or after the GPIB read/write function, so long as they happened before moving onto the next frame. I have tried increasing the length of the wait time in the loop but this does not seem to help. If you have any ideas I would be again most appreciative.
Thanks!!