11-06-2010 12:03 PM
Hi all,
I have a labview program(very complicated for me to understand) designed for an instrument used for counting the electrons. This program records the counts for a stipulated period of time. Now if I have to save the data, then I have to press the "save" button on the front panel in the measurement section.
Now I want to make some changes in this program. I want to remove this "save" button and I want the program to record scans for stipulated period of time and immediately after the time is finishes, automatically ask me for the file path to save my data. After giving the filepath, the data would be saved in that particular file.
guys!!! please bail me out. I have tried my best to do this but I could not understand the program itself. It would be nice of you if you could tell me what changes I have to make in the program to make this happen.
Warm Regards,
Srinivas
11-06-2010 12:43 PM - edited 11-06-2010 12:46 PM
You did not include any of the subVIs.
Who wrote this? Everything seems to be done with references and local variables, which is not that great.
@jkfhdskh wrote:
I have a labview program(very complicated for me to understand) designed for an instrument used for counting the electrons.
For now we can ingore the two frames on the left, they are just for initialization. The program itself is not difficult to understand.
There are two big while loop that operate in parallel.
The left one handles the user interaction and checking of the serial port. It checks the serial port every 5ms for new data, and if there is, it gets placed in the queue. The queue is probably read in one of the subVI via a reference to the queue, but since you did not include the subVIs, I cannot tell where.
The other event cases execute when certain user interactions occur. Look at the "save as" event case. That's what you want to do when the experiment finishes. (Instead of reading and re-writing the temporary log, we could just copy to a new new name via file dialog)
The right while loop seems to do some processing and logging to disk at regular intervals. (Bad programming: if measurment is off, this loop consumes all available CPU doing nothing!)
Overall, the front panel is quite nice, but the code was probably not written by a seasoned LabVIEW programmer. Looks more like something a C programmer would do after playing with LabVIEW for half a day. 😉
I would probably re-architect the code from scratch. 😮
11-07-2010 01:14 AM
Yes I agree but you did not say anything about what I should do to make changes in the program. if you require any more information then please do not hesitate to ask me. I will be glad to submit.
Regards,
Srinivas
11-07-2010
02:21 AM
- last edited on
10-10-2024
10:09 AM
by
Content Cleaner
@jkfhdskh wrote:
Yes I agree but you did not say anything about what I should do to make changes in the program.
Yes, I did: I said:
"Look at the "save as" event case. That's what you want to do when the experiment finishes. (Instead of reading and re-writing the temporary log, we could just copy to a new new name via file dialog)"
I don't have any of the subVIs and I don't know what you really want. I also don't know how much you know about LabVIEW. Where do you enter the "stipulated period"? Do you want a new control for that?
Making decisions based on elapsed time is not hard. There is even an "elapsed time" express VI. Have you tried a forum search?
11-07-2010 11:00 PM
Hi
My due apologies. The problem is there are so many sub vi and I can attach only 3 sub vi along with this question. Please tell me which subvi you want and I will attach that .
Actually, I need to carry out an experiment(Bremsstrahlung Isochromat Spectroscopy) which includes an electron gun which supplies elctrons, a power supply and lock in amplifier(SR510) for supplying energy to the gun. The voltage is kept constant(say 1490V) in the power supply. A lockin is connected to the power supply. As the lock in has a variable voltage of -10V to +10V, by varying the lock in voltage, I can get a set of voltage from 1480V to 1500V. A channeltron which amplifies the electrons, a detector which detects the electrons and a Measer solo which provides the energy to the detector as well as counts the electrons as well as saves the data.
I am writing a labview program for lockin amp. The following steps are involved in my program:
1. Initialize: This initializes the lock in amp.(enters into remote mode)
2. Apply voltage: The lock in starts applying voltage (say 5V). The user can vary voltage by using command for lock in.
3. Call Measer: After applying the voltage, the program waits for 1 sec to make the power supply stable and then recalls the measer program to start the detector and switch on the counter. The measer program runs, the detector is started and count is recorded. Now here, to save the counts, I need to press the button "Save" and only then I will be able to save the data. But I want the program to automatically save the data, and enter into next step.
4. Increment voltage: After the measer saves data, it enters into the next step and increments the voltage from 5V to say,6V and the whole process is again repeated till the voltage becomes 10V.
5. After the data is recorded for all the voltages defined by the user, the program stops.
I am still learning labview. I learnt that to write the above program, the state diagrams would be of great help. But I am not able to proceed forward. I am finding difficulty in step3 and step4 particularly. I am writing the program in serial mode(RS232). I would be glad if you sort out this problem.
Warm Regards,
Srinivas
11-08-2010 12:23 AM - edited 11-08-2010 12:23 AM
Hi Srinivas,
Try zipping your files and then uploading.. As most of your vis are missing and your program is having so many references in it, its very tedious and time consuming to go through your entire program. Also it is hard to make out what actually you are looking for. As per my understanding, for automatic saving, may be you can make a condition for getting the counter inputs (when the counts are recorded condition turns true) or an elapsed time recorder as per your requirements and wire it to the case selector of your save as case structure instead of the save button. By doing so when the counts are recorded the save as structure runs automatically.
Regards,
Nitz...
11-08-2010 03:53 AM
Hi,
I have zipped all the sub vi and attaching it. please go through it and suggest me.
Regards,
Srinivas