07-17-2014 01:21 AM
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?
07-17-2014 03:36 AM
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,
07-17-2014 04:42 AM - edited 07-17-2014 04:43 AM
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
07-17-2014 06:40 AM
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.
07-17-2014 06:48 AM
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.
07-17-2014 06:56 AM
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,
07-17-2014 07:20 AM
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.
07-17-2014 07:27 AM
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
07-17-2014 08:55 AM
07-17-2014 09:27 AM
Indeed using state machine could work as well.
Try to build small functions, and then regroup them into an higher level VI.
BR,
Vincent