LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Please help! I have no idea what I am doing

Solved!
Go to solution

I am working on a project for my thesis. The person that was helping me in LabView got a new job and left his current job. He is no longer available to assist me.  I have attached the program that we have been working on.  I know next to nothing about LabView and would like it if someone could program this for me.  It shouldn't take that long.  I have gotten the program to work if I push buttons on the front panel, but I need it to be automated.  I need it to take measurements every 5 minutes and process the data 10 seconds after each measurement is taken.  Is this easily fixed with the program that I have started.  I know the program is not the cleanest right now, but once again I know nothing about this.  If you can't help me write the program, how much would it cost to pay someone to write it? Thank you everyone for your help.

0 Kudos
Message 1 of 27
(3,518 Views)

"Please help! I have no idea what I am doing"

 

I admire your honesty.  This is a duplicate post, but since you've explained how you were abandoned, I'm inclined to help.  I'll say one thing, your partner didn't know much about what he was doing either.  Maybe he knew the algorithm, but he surely didn't know about Labview programming style.  It will take me some time to straighten this out, maybe re-write it in a form that is more maintainable.  I'll get back with you later.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 27
(3,508 Views)

Thank you so much for giving it a try. He really left me this bundle of mess and never explained anything that he did.  

0 Kudos
Message 3 of 27
(3,504 Views)

It will be tomorrow before I can finish.  Getting late here.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 27
(3,475 Views)

Ok. Not a problem at all. Thank you so much!

0 Kudos
Message 5 of 27
(3,472 Views)

I'll leave it to tbob to decide if he's going to write the code for you - that's his prerogative.

 

If you want to run the code every 5 minutes you essentially need to put the code that's inside the loop inside a case structure. The case stucture needs to be triggered based on hitting 5 minutes. You can just monitor the amount of time that has passed and when you've hit 5 minutes, do your stuff. You can use the Time Delay function to delay your processing, using the error clusters to control execution order. Something like this:

 

It's not clear whether the VISA Read needs to be inside or outside the case structure since you haven't explained what's being collected with that.

0 Kudos
Message 6 of 27
(3,454 Views)

Both tbob and smercurio are right.  Smercurio provided a nice design pattern that could call a sub-vi that executes your code every 5 minutes.  Your code could become that sub-vi.

Tbob is correct that the code needs improvement, especially with the local variable abuse.  I can see some potential race conditions.  Plus some coding style that is definitely being broken by placing Case Statements over wires (or objects).  That's a big NO!!  NO!!. 

0 Kudos
Message 7 of 27
(3,406 Views)

Laplanmd, I have a question before I can finish this project.  The old code looks like it works like this:

The serial port is read.  Then the serial port is written to only if the Collect Data button is pressed.  Then some processing goes on in the nested Case structures, which manipulates the data buffer and sample count.  Then if the Process Data button is pressed, that case executes.

If neither button is pressed, the serial port is read and the data buffer cases execute, and this repeats.  Is this correct, you read the serial port every loop iteration and process the data buffer?

Now for what you want.  You want to keep looping, reading the serial port and processing the data buffer and sample count, until 5 minutes have gone by.  At this time, on the very next loop, you want to read the serial port, then write to the serial port. then do the data buffer and sample count, then wait 10 seconds, then process the data (freq spectrum part).  Is this correct?  Or do you want to not read the serial port when you write to it.  The data buffer and sample count cases get executed no matter what time has gone by?

 

I'm almost done.

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 27
(3,364 Views)

Here is what I have so far.  I'm still not sure about some parts, like reading the serial port on every loop and executing the top case structures on every loop.

The vi is written in LV2009.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 27
(3,347 Views)

I tried loading it and it says that there is an error because I have 7.1 and it was written in 9.0 is there a way around loading this? Thank you for your help

0 Kudos
Message 10 of 27
(3,319 Views)