LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problem to sort data in array

is it like this?how do i make it process a loop in multiple of four?

0 Kudos
Message 21 of 50
(1,254 Views)

You still haven't added a small wait to the serial loop.

 

 


@icycool wrote:

how do i make it process a loop in multiple of four?


Well, do you at least have an idea how you could do it? 😮

 

Here's one very simple possibility:

 

Don't read until the "Bytes at port" are larger than 4, and the only read multiples of four (see image. The false case is wired across.).

 

 

Still, I don't like it. How is the data sent? What if you lose a byte and the frame shifts by one byte? Everything will be meningless. Right?

 

0 Kudos
Message 22 of 50
(1,250 Views)

sorry im a bit confusing here..huhu..is this ok?

actually, i still dont know how the data will be sent bcause its still in process..so right know im just create this vi. by assume the data will be sent continuously in 8 bytes which the 1st 4bytes is the element and remaining 4bytes is their value

0 Kudos
Message 23 of 50
(1,244 Views)

Since you said it is a binary string, there are only two bytes for the tag and two bytes for the value, for a total of 4 bytes per unit. Right?

 

(As I said, it's a bit clumsy with your current implementation. You should make the right loop into an action engine subVI that gets written to in the serial loop.)

0 Kudos
Message 24 of 50
(1,234 Views)

oh sorry..im bit careless there..so means i assume my vi. will continuously receive 4bytes or maybe 8bytes per unit

 

can u explain more on that i should make the right loop into an action engine subVI that gets written to in the serial loop?

0 Kudos
Message 25 of 50
(1,229 Views)

how do i changes this vi so that i've only one stop button to stop the whole program?

i try it but still didnt work

0 Kudos
Message 26 of 50
(1,170 Views)

Hi,

 

You can create a local variable by right clicking on your stop control.  Attacht this to the stop condition in your other loops.  Hope this helps!

 

Thanks

Jon S

Applications Engineer
National Instruments
0 Kudos
Message 27 of 50
(1,156 Views)

i've tried it but didnt work..i make a local variable from loop 1 and connect it to stop at loop 2 and vise versa but still cannot

0 Kudos
Message 28 of 50
(1,151 Views)

Did you read the error message you get when you try that?  It points out that you cannot use the latching mechanical action for booleans when using a local variable.

 

So.  Change the mechanical action to Switch when Pressed.  (Use the switch in the event case.) Put a local variable in the other loop to stop it.  After booth loops are stopped, write a False to another copy of the local variable to reset the Stop switch before the next run.

 

You should put a delay in the False case of the upper loop to keep it from grabbing all the CPU time when Read is False.

 

Lynn

0 Kudos
Message 29 of 50
(1,140 Views)

What kind of error do you get when you try this?  I can't see why this wouldn't work, so any information would be helfpul!

 

Thanks,

Jon S

Applications Engineer
National Instruments
0 Kudos
Message 30 of 50
(1,133 Views)