LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to select two strings and send to a serial write using case loop

Solved!
Go to solution

I had a serial write which have to take different commands at different cases. The same serial read should read both. How can I do it. Means if I have a string 500\r\nZ. I one case it should be -500\r\n Zand other case +500\r\n Z. But boyh of these cases have to be read with one serail write . How can I do iit . Please help

0 Kudos
Message 1 of 16
(3,184 Views)

Hi perumpadapu,

 

I would use a simple select node:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(3,182 Views)

not like this I need when -500 or +500 . These are two conditions applies to a serial port. The condition for these two commands is different. So using this code If condition is wrong the other case will be considered I don't need like that. I need the help such that when the input is - values It shold take -500 and when the input is not equal to comparing value then no command should sent. When the input is positive but the number is comparable to the comparing value, then the command should be +500. So what I have to do

 

0 Kudos
Message 3 of 16
(3,166 Views)

Hi perumpadapu,

 

use a comparison function and a case structure. All your "IF-THEN-ELSE" is just realized with compare-and-case-structure.

 

When you're not comfortable with designing logic you should draw your thoughts on a sheet of paper first!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 16
(3,164 Views)

comparison will not work I will sent the required thing in this reply

0 Kudos
Message 5 of 16
(3,155 Views)

Hi perumpadapu,

 

I still don't get what's the problem in using a case structure???

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 16
(3,149 Views)

Hi 

                      My first question to you is how you are creating such images ?  Is there any shortcut method for this?

 

2nd question. Instead of using two VISA write if at a time only 1 condition is true then we can combine the strings. Because after VISA initialization this 2 VISA write condition is then this connection will pose problem ?

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 16
(3,146 Views)

Hi Ranjeet,

 

those pictures are snippets...

 

2nd question:

The OP has to provide a VISA resource wire. By doing so he can execute one case after the other. He also wanted to have the VISA-Write in the cases as he wrote "don't write anything if case is not true": easiest is to put VISA-Write in the TRUE-case...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 16
(3,144 Views)

Why cant like this ?

I think this is also OK 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 9 of 16
(3,140 Views)
Solution
Accepted by topic author perumpadapu

You can't gaurantee that both conditions won't hit at the same time.  You will need to send a separate command for each condition.

 

Plus, using EQUALS on floating points is dangerous.  You might never get the condition because a really low bit could be off.


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 10 of 16
(3,131 Views)