You still haven't added a small wait to the serial loop.
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?
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
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.)
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?
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
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!
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
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.
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!