LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

[LABVIEW] Why serial write send twice after send boolean true?

Solved!
Go to solution

Hi all,

 

I'm new with LABVIEW and currently I'm doing write and read serial simultaneously in two separated while loop (read and write).

The first while loop (read serial) is working fine where it will continue read serial without condition.

The second while loop (write serial) will send serial write only when i send boolean true (1).

 

My problem now is whenever I send a string through serial write, it will read twice for what i have sent. 

For example, I try to send "Hello" through serial write but it come out as "HelloHello" in read serial.

I want the serial read the exactly string i had sent through serial write.

 

Can any LABVIEW PRO help me??

 

Thanks.

 

0 Kudos
Message 1 of 5
(3,149 Views)

Can't troubleshoot your code without the code.  Post your VI.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(3,147 Views)

Hi Crossrulz,

 

Thank you for the fast reply. I have attached the VI.

 

My problem:

If i send a string "Hi" through the control string (SEND COMMAND). it will hold until i press the (SEND) boolean button.

I should receive "Hi" from the read indicator (READ) instead of "HiHi".

 

Thanks.

 

 

0 Kudos
Message 3 of 5
(3,133 Views)

Sorry, let me update my VI.

 

thanks 

 

0 Kudos
Message 4 of 5
(3,127 Views)
Solution
Accepted by topic author GavinT

Looks like you have a race condition.

 

1. Change the mechanical action of the Send to be a Latch When Released.  This will cause it to be reset when the terminal is read.

2. Get rid of the Reinit To Default.  If you follow 1, they are not needed.

3. No need for that loop inside of your write loop.  That can cause an infinite loop.  Even better would be to replace it with an Event Structure.  Then you can detect the Send button's value changing and only send in that case.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 5
(3,114 Views)