LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modular Programming in LabVIEW 7 SE

Hi All
 
I am trying to  do modular programming in LabVIEW inorder to do my block processing and give an impression of a real time processing unit. I am having problems trying to figure out how to do so. I have attached my VI along with this post, please if you can take a look and suggest any approach that I can take to do modular programming. Currently, I am using a collector to collect a defined number of samples and save it to a memory location. That data in the memory location will be used by MATLAB later for signal processing. But I see that the VI does not eve run, the data is not being saved onto the files. I dont know where the problem lies. Please help me out!!
 
The VI somehow freezes on me and I have to press the abort button instaed of the stop button, since the stop button is useless after I start the VI once. Previously, I tried using relays to do modular programming, but that did not work out for me so I decided to use the collector instead. If anyone can help in this issue, I will be really very grateful, as this is a major part of my thesis project.
 
Thanks in advance
 
Rohit Narula
Rohit Narula
4th Year Electrical Engineering
Ryerson University, Toronto
Ontario, Canada
Email: rohit.narula@gmail.com
0 Kudos
Message 1 of 11
(5,532 Views)
Have you tried running this VI with execution highlighting turned on?  You'll see that it gets stuck at the elapsed time VIs.  As you have not set any target times, they do not exit.
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 2 of 11
(5,523 Views)

Actually, the elapsed time functions have targets of 5 and 10 seconds (just right click and select properties).

From what I can tell, the formula node in the center of the diagram has an infinite while loop. It is this that is hanging up the program. The while(1) has no break statement to exit the loop.

0 Kudos
Message 3 of 11
(5,521 Views)

Hi Dennis

Thank you very much for solving this problem of mine. That did take care of the frozen output. Any suggestions on how I can do modular programming?

Thanks

 

Rohit Narula
4th Year Electrical Engineering
Ryerson University, Toronto
Ontario, Canada
Email: rohit.narula@gmail.com
0 Kudos
Message 4 of 11
(5,505 Views)
Define modular programming. Aside from the problem with the formula node, what are you trying to do? What is the purpose of all of your elapsed time functions? Why do you have two separate Write LabVIEW Measurement File functions? If you're are trying to write only when one of the elapsed time is true, you should be wiring the enable input of the write function. The way you have it now, you are writing data with every iteration and on some passes, there is no data to write.
0 Kudos
Message 5 of 11
(5,499 Views)
I'm sorry, I didn't see that.  My bad! Smiley Surprised
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 6 of 11
(5,493 Views)

I will just explain modular programming. Its just another term for block processing. What I intend to do is fake real time programming. You got me right, I have two LVM files because I want to process them alternatively. I want to wrtie to one file, while the other is being processed. Since I cannot read and write from the file at the same time, I have taken this approach. I want to give 5 seconds to each file to be written, then the next 5 seconds, the file is read by MATLAB is processed (while this is happening, data is being written to the other file for 5 seconds), and at the end of 10 seonds, the file is reset and fresh data is input to the file.

I hope this helps understand what I am trying to do. I am having a timing issue with this. I am only able to write to one file contineously, and it doesnt even get reset after the time elapses.

Another thing I noticed that the time elapsed indicator for the 2nd timer is always ON. That is weird.

 

Rohit Narula
4th Year Electrical Engineering
Ryerson University, Toronto
Ontario, Canada
Email: rohit.narula@gmail.com
0 Kudos
Message 7 of 11
(5,493 Views)

If you just want to swap between two files, look at the attached VI. If uses a single elapsed time function, a shift register, and an exclusive or to make a Boolean high or low for 5 seconds. This is wired to the enable input with one of them inverted.

Also, you might want to think about using something other than Write LabVIEW Measurment File. It's not the fastest function in the world. It would be much faster to open both files outside the while loop and then inside, use the File Write primitive. You can put them inside a case statement to enable/disable the one you want.

Why is it weird to have an elapsed time indicator always on? That's what it is supposed to do - show a running elapsed time.

0 Kudos
Message 8 of 11
(5,487 Views)
Here is another variation on your theme.

Lynn
0 Kudos
Message 9 of 11
(5,480 Views)
I've cleaned up your VI a little.  It could use some more work to get the data flowing left to right.   I removed the code block and replaced it with some boolean logic and got rid of the infinite loop.  I also added a reset signal to Write LabVIEW measurement File 2.  You will have to select new directories for your data files as they are specific to my system.
----
I am the founder of CnCSoftwareSolutions. When not cleaning up baby drool, I write about test data or work on Vision, a tool for understanding your test data. Visit me at www.cncsoftwaresolutions.com
0 Kudos
Message 10 of 11
(5,480 Views)