LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay problem

Solved!
Go to solution
Wait, I didn't mention about flat sequence anywhere in my previous post. Can you post what you tried with two loops?
Thanks
uday
Message 21 of 49
(1,535 Views)

No I tried it before u mentioned it, I tried everything my little brain could do 🙂

 

This is what I did:

 

post2.png

Everything is the same to the right of the image, and in the control panel :

post3.png

 

The down graphic starts and it shows everything correctly but the upper one is empty, then i press the stop of the down side and the graphic stops, and it starts showing in the upper graphic the data from the other sensor, so everything is cool but I need them to be working at the same time 🙂

 

Of course when i press the other stop the program stops.

 

I tried it before without the structure, the exact same thing but without the flat sequence! Then both graphics would work but with the data merged together on both of them!

 

Thank you again for giving me some of your time!

0 Kudos
Message 22 of 49
(1,529 Views)

Hi Co0ki3,

Thanks for the code screenshot.

-Yes, please delete sequence structure, no need ot it. If you use sequence structure it will force one by one only. But what you need is parallel right? so first delete it.

-If you remove sequence structure, still you will get same data, because you are using same sub vi for sensors. Use different subvis with same code with diff names.

That includes user event queue also.

-You can use single stop button to stop both loops. Use local variable of stop button to stop other button.

 

-You are almost done, but sequentially you are getting data. Just use same loops parallelly and you will get answer.

 

Thanks
uday
Message 23 of 49
(1,506 Views)

I am very bad at this 😞 I can't even do the single stop button to stop both loops without finding errors!

 

This is what I did after reading your post udka, I deleted the sequence structure since I want parallel. Then I went to the folder where the original program was and copy pasted the 2 subvi (onSpatialData and GlobalVariables) and changed their names, then i swap them in the right part of the code, where u can see the label is diferent with their current names in red, then I also moved the unregister for events to the right side of the loop as you mentioned before:

namechange.png

But this still doesn't work, because I dont know how to change the user event queue, can u explain a bit more how I can do this? I tried to google it and I couldn't find anything that helped me on this.... Sorry for being so ignorant in LabVIEW lol !

 

Then I tried to use single stop button to stop both loops, this would be great when implemented so thank you for telling me this tip, but even after trying so many diferent ways to do this LabVIEW always had an error, (If a Boolean control has associated local variables, it cannot use latch mechanical action. The first local variable to read a Boolean control with latch action would reset its value to the default.)! I searched for examples in the LabVIEW help and did the same as it is in the example called "Stopping Parallel While Loops without Reset.vi" and now it looks like this:

2on1stop.png

The error is still there but I dont know how to solve it....

 

 

0 Kudos
Message 24 of 49
(1,491 Views)

I will add the files as an attachment if u want to take a closer look, I know that without the sensors you can't really see things by yourself and see if they work ok, but it might help anyway! Thank you again for your time.

0 Kudos
Message 25 of 49
(1,489 Views)

Hi Co0ki3,

thanks for reply. You are right about latch action of button. Why don't you use same button event in two event structures? Like add event for same button in both event structures in two loops and send true const to while loop condition.

-There are multiple ways of doing it to stop multiple loops with single button google this and you will get more ideas on it.

-Unfrotunately code which you sent me is not what shown in your previous message. Is it possible to send the same code shown in your previous screnshot(Just to look at it, because i cannot run and tell you whether it is working or not).

-Can i know why you are getting the attached and serial no inside while loop? Why not keep outside of while loop or will it change frequently?

-Are you sure your onspatial data global variables are two different?  Because if you are using same global variable then you will be adding same to the variable.

Please keep probe in both onspatialdata and onspatialdata2.vi at the global variables and see if they are getting different values or not and also at event data.

-For info on creating and using user events please check this http://zone.ni.com/reference/en-XX/help/371361K-01/lvhowto/creating_user_events/ and this http://zone.ni.com/reference/en-XX/help/371361H-01/lvconcepts/user_events/

-I think there is no problem with your user event strucure.

-Please keep probe at .NetRefnum inside each event structures in your main loop and see if you are getting different data or not?

 

-Sorry, if you don't know how to keep probe- right click on required wire and select probe.

 

Thanks
uday
Message 26 of 49
(1,455 Views)

Ok, I will try to do what you said, thank you again for no giving up on me lol!

 

Hm, the code for my previous message is the one called spatialtest4.vi and the original one, made by the manufacturers is the one called Spatial.vi, I was getting the attached and serial number inside the while loop because thats how it was made by the manufacturers in the original file, I think its inside the loop for when u want to change sensors while the program is running, that way it will identify a new one and if it is attached or not!

 

I will start working on what you told me now and post any improvements! I was trying some new things before and they didnt work, like changing every block to a newsubvi and trying to modify them lol, but the problem is that i can't change the .NET refnum 😞

0 Kudos
Message 27 of 49
(1,447 Views)

They all give diferent numbers when I probe, that is good right?

0 Kudos
Message 28 of 49
(1,444 Views)

This is what I got on the probes:

probes.png

 

Of course the probe 1 and 7, and the 8 and 2 give the same Values because they are on the same wire, I just did that out of curiosity lol !

 

0 Kudos
Message 29 of 49
(1,438 Views)

Sorry for the spam.... but I probed inside the case structure as u mentioned too and found this:

probe2.png

 The value of the probe 1 keeps changing very fast and the other one is not executed, but the top graphic shows the data aquired from both sensors.

 

0 Kudos
Message 30 of 49
(1,424 Views)