LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in execution when putting a vi inside another vi

Hi all,

 

I have an application vi which is meant to tx and rx serial data via COM port. When I run this vi individually,it works fine. But when I put this vi inside a main vi which provide this application vi some inputs and in turn expects some outputs, the application vi doesnt tx & receive the entire data properly.Also while debugging the main vi, it becomes fine and then there are no issues but during run time it doesnt work properly..Any suggestions on why this is happening?

 

Will making the application vi "inline" serve the purpose?

0 Kudos
Message 1 of 15
(3,638 Views)

Hi,

 

I'm french so my english is not very good but i will do my best for help you and be understood. Can you put your VI in line? i will take a look and give you an answer if i find the problem.

 

Cordially,

Geoffrey BARBIER
élève ingénieur Polytech'UPMC E2I
CEA Saclay
0 Kudos
Message 2 of 15
(3,619 Views)

Hi mnx,

 

I didn't understand 100% your issue...

What COM are you using ? (LAN, GPIB, RS232 ... )

Are you running this VI on a target ?( FPGA ?)

Post your VI will improve dramastically our ways to figure out what is your problem !

Tip : Create a new Lvlib to share your main and subVi

 

BR,

Vincent

0 Kudos
Message 3 of 15
(3,607 Views)

At this point in time, we are taking complete shots in the dark.  We need to see your code to be sure.

 

But here's my best guess:

Your subVI is opening and closing the VISA session.  The constant opening and closing of the port is causing your TX and RX to become truncated.  If you just open the port in your main VI and pass the reference into your subVI and then close the port at the end of your main VI, things should start looking better.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 15
(3,591 Views)

Hi,

 

attached are the images of application vi which works fine when run individually and the main vi through which it doesnt run as expected.

Download All
0 Kudos
Message 5 of 15
(3,584 Views)

Hi,

 

Can you check that the format of your data TX is an unsigned 8 ? If this is not the case, you must convert.

 

Cordially,

Geoffrey BARBIER
élève ingénieur Polytech'UPMC E2I
CEA Saclay
0 Kudos
Message 6 of 15
(3,575 Views)

You really need to send 1 byte at a time?  Your application VI could be simplified quite a bit just by using a FOR loop with autoindexing.  Some of those sequence structures aren't needed either.

 

I'm still not liking that constant opening and closing of your serial port.  You are closing the port, right?  I don't see a VISA Close in your screen shots.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 15
(3,567 Views)

Hi again mnx,

 

Your VI looks ugly... sorry

I suggest you to recode all your VI.

Don't use event structure, you don't need to.

Try to cut your fuctions by subVI ; One called OPEN, WRITE INTPUTS, READ OUTPUTS, CLOSE

and then drag and drop all your fuctions into your main.

That way it gonna be cleaner and debug your application gonna be easier.

 

BR,
Vincent

0 Kudos
Message 8 of 15
(3,560 Views)
http://forums.ni.com/t5/LabVIEW/Special-RS232-communication-implementation/m-p/2924162#M845954

Hi all,
I have created the vis for the application mentioned in the link above.. Also the point is it works fine when I run it individually but not if if I call it thru some other vi..please help
0 Kudos
Message 9 of 15
(3,534 Views)

Indeed using state machine could work as well.

Try to build small functions, and then regroup them into an higher level VI.

 

BR,

Vincent

0 Kudos
Message 10 of 15
(3,517 Views)