LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

queued state machine

Solved!
Go to solution

Smiley Very Happy Smiley LOL

0 Kudos
Message 11 of 19
(591 Views)

Hallo again.

I tried to improve the code based on the comments from yesterday.

With 1 queue:

snip - start.png

snip end.png

 

With 2 queues code A

snip.png

With 2 queues code B:

snip.png

 

 

0 Kudos
Message 12 of 19
(583 Views)

Your 1 queue code is closer to what I do.  One additional trick: you can store the timeout in a shift register.  So my typical applications default to timeout of -1 (wait forever) and when commanded initialize and start reading data.  When in the initialize state, I write a 100 into the timeout shift register so that I will go into the Read state if no messages were received.  And when a Stop command is sent, I can set the timeout back to -1 (wait forever for another message).  I typically then also have an Exit command that I use to stop the QMH.


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 13 of 19
(559 Views)

With the exception of not using a type def for the Enum you have a fair grasp of the QSM There are thing I would have done different but, I haven't read your design specification. 

OK, I am going to pick on your code just a littleSmiley Surprised

 

First I just have to ask about the Counter Global.vi.  My question really boils down to curiosity on what exactly was your thought process when you determined that you needed to pass a scalar value to subvis via global and update the value in the caller via wire?  Seriously, I'm not trying to ask WTFWYT? but understanding your process will help us teach you better.

 

Next, I suggest you take a good long look at the QMH Template Documentation compare and contrast that with your 2 Queue A and B examples.  Then make sure you support your computers ecology!  Those bits and bytes can easily be recycled into useful code in the future.

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 14 of 19
(554 Views)

Hi Crossrulz. I will try to incorporate that in my program. I will return with the code 🙂

0 Kudos
Message 15 of 19
(542 Views)

Hi Jeff.

Thank you for you feedback

I’m normally always using type dif. In this quick example, I did not, I know.

The global. Again - it was just a quick example and have nothing to do with the program I’m working on.

What I’m really planning to do is get data from a BROOKS mass flow controller using at 0254.

https://www.brooksinstrument.com/en/~/media/brooks/documentation/products/accessories%20and%20softwa...

The subvi in my program is in reality a sub which gets data from the 0254. The duration is around 1000 ms.

I actually newer – until now - using globals, and there are no use for it in this situation, I know.

This weekend I will have a look, at the QMH documentation. I think that’s a very good suggestion

Thank you for you feedback

I’m normally always using type dif. In this quick example, I did not, I know.

 

The global. Again - it was just a quick example and have nothing to do with the program I’m working on.

What I’m really planning to do is get data from a BROOKS mass flow controller using at 0254.

https://www.brooksinstrument.com/en/~/media/brooks/documentation/products/accessories%20and%20softwa...

The subvi in my program is in reality a sub which gets data from the 0254. The duration is around 1000 ms.

I actually newer – until now - using globals, and there are no use for it in this situation, I know.

 

This weekend I will have a look, at the QMH documentation. I think that’s a very good suggestion

Message 16 of 19
(536 Views)

QMH - good

 

QSM -

 

Spoiler

 

 

Now regarding the Brooks 0254 and the serial interface. Good example of a bad interface. You ask for channel 2 and it give you channel 3. Even their shipping example includes a loop that repeats a command until it replies correctly.  So don't be surprised if you start getting goofy values.

 

Ben

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 17 of 19
(519 Views)

Ben ! Now I get a little nervous  - Can you elaborate on that?

0 Kudos
Message 18 of 19
(501 Views)

@Michael.Koppelgaard wrote:

Ben ! Now I get a little nervous  - Can you elaborate on that?


Exactly what THAT would you to read more about?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 19 of 19
(476 Views)