LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

crazy problem with two programs

Hi everyone,
Below are the two codes which work prefect when I try to run individuallly, but when I combine them into one and try to run everything fails and neither the COM3 port code works nor GPIB16 code Smiley Sad

Can anyone figure what can be the problems, what changes I need to make...
Looking for help,
Regards
0 Kudos
Message 1 of 16
(3,202 Views)
Please try to attach your code once more. It did not make it.
0 Kudos
Message 2 of 16
(3,193 Views)
Hi,
attached the codes again...I hope you can open them now...
Regards
Download All
0 Kudos
Message 3 of 16
(3,189 Views)
How are you trying to "combine" them? There does not seem to be an obvious "this value gets fed to this input".
0 Kudos
Message 4 of 16
(3,166 Views)
i couldn't get you.
I'm just doing copy paste the Agilent.vi in the final vi.
The Agilent vi is a built in vi available with the GPIB NI 488.2 drivers package.
i.e just copying the agilent block diagram inside the while loop of final vi.
Should I make the whole block diagram once again wihtout copying...
or can two stops in one block diagram creat problemSmiley Sad
waiting for help
Regards
0 Kudos
Message 5 of 16
(3,160 Views)
You are trying to put the code for the Agilent inside the loop of the other program? That doesn't quite make sense to me. What happens when you do that, the two loops will not execute in parallel. The innermost loop will run to completion, then the code outside that will run, then pass control to the inner loop, which will then run to completion again, etc. It seems to me that you would want to paste the code outside the existing loop or paste it inside the existing loop but delete the loop you have around the Agilent code.
0 Kudos
Message 6 of 16
(3,151 Views)
I deleted the while loop of final.vi(the outer most loop) and by calculating the number of pulses in the final.vi code i want to pass it to the agilent code...so that the agilent codes runs for that number of times...By the time agilent code starts running Visa write should have completed it's task on the serial port.
I.e Visa write(of number of pulses to serial port) and number of pulses to agilent code should run next to each other...
Both these codes run perfectly when I run them individually but when mixed...I mean copy paste of agilent into final.vi everything failsSmiley Sad

Can you please figure itout...
Rohit
0 Kudos
Message 7 of 16
(3,127 Views)
The attached is how I understand what you want to do. I didn't do much cleanup of your wiring. You could also make the agilent code a subVI. The block diagram, as a rule of thumb, should be no more than one screen size big.

Message Edited by Dennis Knutson on 05-30-2007 07:24 PM

Message 8 of 16
(3,121 Views)
Hi dude,
After slowly something is working but again somw crazy problems...Could you please help me out.
As you can see in the vi... I'm working with two loops one is the while loop for accessing the serial port via Visa protocol and other is the for loop for GPIB-488.2 . To make both the loops run in one program I'm again using a while loop at the outermost, which is running always.
Now, the problem is both the loops work fine when I try to run them seperately in different programs. But here if you try to run the for loop it doesn't start.
Infact, you can see the value of no. of pulses/data points and check  points blocks are not same even when both indicatior blocks are connected to the same pulses wire.   And hence the for loop for GPIB doesnt start and no data comes in from network analyzer in the graph.
Could you please help me figure out what's happening here!Smiley Sad
Regards,
Rohit

0 Kudos
Message 9 of 16
(3,087 Views)
Did you look at the version I posted? Yours won't work because you do not understand one of the basic concepts of LabVIEW. It's called dataflow. You have the for loop outside the main while loop and you have an output of the while loop wired to the for loop. Dataflow says that the for loop will not start until all of the data for it is available. The value you wired to the for loop will not be available until the while loop finishes. The version I made had the for loop inside the while loop and it would start at the same time as the serial write because I used dataflow. The error wire that is connected to both the serial write and the other means that they start at the same time. The number of pulse is also available because it's wired inside the loop.
 
You might want to spend some time learning the LabVIEW basics. There are some free on-line classes at http://www.ni.com/academic/lv_training/how_learn_lv.htm.
0 Kudos
Message 10 of 16
(3,075 Views)