Jump to content

Redundant State Machine ?


Recommended Posts

Your consumer loop (bottom) waits on a notifier; default is -1 (wait forever).

Your top loop has a timeout of 100 ms, and sends a Timeout notifier every 100 ms. :blink: You don't need to send a timeout unless the bottom loop needs to perform some periodic action; it will just "wait forever". That's the nice thing about user events, no polling or no-op type loops!

You should consider using typdefs for your enums; if you add or rename a case later on, you would have to edit all the enum constants in all the different cases on your block diagram(yuck!). I usually name the typdef control to match the vi name..

Looks good! :thumbup:

Link to comment
Your consumer loop (bottom) waits on a notifier; default is -1 (wait forever).

Your top loop has a timeout of 100 ms, and sends a Timeout notifier every 100 ms. :blink: You don't need to send a timeout unless the bottom loop needs to perform some periodic action; it will just "wait forever". That's the nice thing about user events, no polling or no-op type loops!

You should consider using typdefs for your enums; if you add or rename a case later on, you would have to edit all the enum constants in all the different cases on your block diagram(yuck!). I usually name the typdef control to match the vi name..

Looks good! :thumbup:

Actually, in the real program, there is a multiple channel/single point data acquisition ocurring, and monitoring of a DIO card during the timeout state.

The various steps (1-4) would coincide with my finite data acquisition (approx 5000 samples per each of 8 channels - 40K total), followed by a process , status, update, and output state, then back to the timeout state providing there wasnt an error generated which is then handled by the error state first. I was using the timeout on the event structure to trigger the timeout state and still allow full UI functionality.

Link to comment
Actually, in the real program, there is a multiple channel/single point data acquisition ocurring, and monitoring of a DIO card during the timeout state.

The various steps (1-4) would coincide with my finite data acquisition (approx 5000 samples per each of 8 channels - 40K total), followed by a process , status, update, and output state, then back to the timeout state providing there wasnt an error generated which is then handled by the error state first. I was using the timeout on the event structure to trigger the timeout state and still allow full UI functionality.

Perhaps I don't quite understand the desired result, but I would prefer two separate VIs running in parallel. One is dedicated to monitoring the DIO card and passing data via Queue to the other VI which processes the data. Or just separate the User Interface portion into a separate VI (I assume the Event Structure handles some other events as well). This could simplify the code and design a bit, IMHO.

David

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.