LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sending data and reading

Solved!
Go to solution

Well guys I have a problem here sending the data.

 

When I made what is in left while loop, it works!

But when I made what is in right while loop I received a lot of crazy values.

 

Problem sending data.JPG

 

Could some one help me on that?

 

The second while loop, I made only some simple math to the example. So don't worry with the math or anything so.

Only in the logic... the correct is I have to receive the correct value in bouth appended array. The only thing will change is the last 3 numbers!

 

 

If anyane can help me on that I will be pleasure!

 

 

 

0 Kudos
Message 1 of 10
(4,022 Views)

Hi EduU,

left and right is not the same and i don't mean the local variables.

 

Why do you need it with the local variables if the other code runs?

 

Mike

0 Kudos
Message 2 of 10
(4,016 Views)
Solution
Accepted by topic author EduU

EduU wrote:

Well guys I have a problem here sending the data.

 

When I made what is in left while loop, it works!

But when I made what is in right while loop I received a lot of crazy values.


That's because you have a race condition due to your use of local variables. In the second loop the local variable instance gets read before you've actually written the new value to the indicator. You may want to peruse this thread

Message 3 of 10
(4,014 Views)

Try this

 

original_mod.jpg

 

It will remove your race conditions.

 

Dan07

0 Kudos
Message 4 of 10
(3,994 Views)

Well guys, I was using Local variable because I use some boolean logic and depends on that the math with the number will be different.. but now I understand when I did the course I learned about Race condition.. but I forgot about it...

 

Now I only did something different and it works... I take off the local variable and linked the number inside the case selector =D

 

Thanks!

0 Kudos
Message 5 of 10
(3,948 Views)

EduU wrote: 

Now I only did something different and it works... I take off the local variable and linked the number inside the case selector =D


Your code shows no case structures, so we have no idea what you're talking about. I'm willing to bet, though, that you probably still don't need to use a local variable and can probably use a wire directly.

0 Kudos
Message 6 of 10
(3,920 Views)

Yes mate, is because the screen I sent is only an example

but yes, you are right... I don't use local variable anymore... I wire directly to case structure and it works nice =D

 

I had forget about race condition... =D

0 Kudos
Message 7 of 10
(3,912 Views)

Hey mercurio... I thought my mistake was at local variable...

but today I fixed it

and still getting me crazy values.

 

So now I will upload a screen from my real code so maybe you can see any difference!

 

Thanks

 

This works:

and this work.JPG

 

and this don't work:

 

why it dont work.JPG

 

The only thing I changed is because before I send the last 4 elements... I check a case strucuture and modify this values... 

but when I see in the other program... I get crazy values.... and in the first picture it works correct! -.-

 

If anyone know why it happens, please help me

0 Kudos
Message 8 of 10
(3,894 Views)
We can't debug screenshots, and we can't see the rest of the code. Please upload your code. Be sure to include subVIs if necessary.
0 Kudos
Message 9 of 10
(3,881 Views)
0 Kudos
Message 10 of 10
(3,879 Views)