LabVIEW code: Event-driven producer-consumer state machine (walk-through)

Поділитися
Вставка
  • Опубліковано 28 сер 2024

КОМЕНТАРІ • 8

  • @sergioa.cervantes4108
    @sergioa.cervantes4108 4 роки тому +2

    Very clear and concise. Thanks a lot.

  • @ericbrenner690
    @ericbrenner690 4 роки тому +1

    A couple of things I see where improvements can me made. Why not just put the Case Structure right around your Event Structure and wire the error cluster to it? That eliminates the guard clause needed after the Event Structure and makes the top loop a event driven state machine.
    In the bottom loop, you don't need that 100 milliscond ms to Multiple. Your Deqeue Element will wait until data comes in or the shutdown clause is sent.
    Get rid of the guard clause since you don't need it around the dequeue element. As a matter of fact, I'd put one large case structure around the entire Consumer Loop While Loop and wire the error cluster to it just like I mentioned in the top loop.
    Doing these things would make your code more efficient.

    • @YM-lm8xr
      @YM-lm8xr 3 роки тому

      wow, this comment of yours actually solved my current problem! thanks a lot!! Feeling lucky!

  • @mehdipaco88
    @mehdipaco88 7 місяців тому

    This was very helpful! Thanks

  • @EmbeddedSorcery
    @EmbeddedSorcery 5 років тому +1

    Is there any way to stop execution in the middle of a state? Essentially skip to the end where it will then realize the next state in the queue is "stop" or "exit."

    • @itsnotallrainbowsandunicor1505
      @itsnotallrainbowsandunicor1505 4 роки тому +1

      Have a look at "Traffic Lightcontroller QSM" by Alex See on youtube,
      /watch?v=1tgnc5OuzV0
      I have built the setup and tried it and it works.
      There is another youtube vid, "LabVIEW Tips&Tricks Episode 3: Event driven state machine" by National Instruments Eastern Europe, which has play, pause, and stop.
      Try "State Machine - LabVIEW Design Patterns" by LabVIEW ADVANTAGE as well

  • @sirhoschi
    @sirhoschi 3 місяці тому

    looks like a QSM