LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Paralel loops and serial communication

Solved!
Go to solution

Can you please convert the VI to 2011 format Smiley Surprised

--------------------------------------------------------------------------------------------------------
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 11 of 29
(860 Views)

@TimBotsM wrote:

However while keep thinking over his post I'm wondering if it would be a "good design" to send with the command (to the serial parser) also a reference to the queue used in the transmitted loop.


Yes! That's one good way to do it. That way, you can use the same subVI for all of the devices. Here's a not-too-clean example:

Send multiple commands.png

0 Kudos
Message 12 of 29
(852 Views)

Why this two consecutive VISA read ?

 

--------------------------------------------------------------------------------------------------------
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 13 of 29
(848 Views)

the backbone of my testrack is an RS485 bus, so if I send data I recive the data as well.

 

I updated the VI and this is how it looks.

picture 3.png

So now I'm wondering: would something like this be a good design?

 

The VI is attached in 2011 format.

0 Kudos
Message 14 of 29
(838 Views)

Friend TimBotsM

                         In RS485 Communication its not necessary if you send data then compulsory you will read response. Nothing like this is defined in the RS485 standard. But mostly Tx and Rx both will be active but not necessary

 

My question is why this two consecutive VISA read ?

--------------------------------------------------------------------------------------------------------
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 15 of 29
(835 Views)

Nothing wrong with that. It leaves you in good shape to modify the tx/rx loop (term-char, different nBytes, etc.) without having to change the message sender.

The bits to clean up will be (at least):

 

1) Deciding how to stop the multiple loops. "Release Queue", somewhere, will cause an error on enqueue and on dequeue. I've heard that called "scuttling the queue".

2) Dequeue timeout stalling the command loop. Scuttling the queue will solve this, but the data coming out of the dequeue will be an empty string.

3) Scuttling the rx/tx loop's command queue will cause the VISA write/read/read to happen again.

 

0 Kudos
Message 16 of 29
(827 Views)

 

As he said - the backbone of my testrack is an RS485 bus, so if I send data I recive the data as well.

In that I said its not compulsory thats it.

 

I am not saying code is wrong or not optimized, What is my question is why this two consecutive VISA read. I am not talking about queue at all.

 

Thanks

--------------------------------------------------------------------------------------------------------
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 17 of 29
(822 Views)

@Ranjeet_Singh wrote:
I am not saying code is wrong or not optimized, What is my question is why this two consecutive VISA read. I am not talking about queue at all.

I replied to his question about the code, not to your question about reads. It doesn't bother me that he needs to read the echo.

0 Kudos
Message 18 of 29
(817 Views)

Friend Todd_Lesher,

                              My mistake, carry on. I thought you are replying me.

--------------------------------------------------------------------------------------------------------
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 19 of 29
(812 Views)

@Ranjeet_Singh Since I use an RS485 bus combined with an FTDI chip I allways get an echo (TX is connected to RX hardware wise). So I need a way to get rid of this echo.

The way I see it I have 2 options

  1. read 16 caracters and split the string
  2. do 2 reads of 8 characters

If I do the 2nd there is a small advantage that if it reads 0 characters on the 1st read I know there is no bus connected and if there is 0 characters on the 2nd read there is no device connected (also a timeout)

 

@Todd_Lesher I'm using the "Queued Message Handler" design patern. So in order to stop all the loops I put in the "exit" string and all the loops should release their queue and stop. If one of the loops enters the "exit" state they'll queue an "exit" (whitout error check) command to the main handler, is the main is already gone, fine, if not, this will stop all the other loops.

I guess with Scuttling you mean something to dump the queue. The "Queued Message Handler" design patern should do the same.

0 Kudos
Message 20 of 29
(808 Views)