02-20-2011 02:51 AM
is it like this?how do i make it process a loop in multiple of four?
02-20-2011 03:32 AM - edited 02-20-2011 03:34 AM
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?
02-20-2011 04:11 AM
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
02-20-2011 10:22 AM
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.)
02-20-2011 10:43 AM - edited 02-20-2011 10:50 AM
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?
03-03-2011 01:52 AM
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
03-04-2011 12:31 PM
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
03-04-2011 12:50 PM
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
03-04-2011 01:11 PM
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
03-04-2011 02:15 PM
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