Something like this should get you started. It assumes that you know how to use state machine, Shift registers, Data flow, Type Defs, Producer and consumer loops, Arrays, Event Structures.
If you don't know how to use all of these things you need to learn or editing this code will be very hard. If you do learn all of this it will be very easy.
This code can get more simple than this. I was trying to keep it simple so that you may be able to follow it.
Thanks a lot for your help.
Would you please attach your original vi here, so I can learn from your vi as an example?
Your vi is more complex than I expected. I am not familiar with state machine and consumer loops. Thank you very much!
That is a VI snippet. Save the picture to your hard drive. Then drag the image file onto your block diagram. Then you should have code in a new VI.
Thank you for your help. Following your suggestion, I have tried but not succeed. Is this snippet only compatible with LabView2017? I am using a LabView 2012. Is there any method to obtain the corresponding Vi? Could you please attach an orignal Vi here? Thank you again for your help.
Yes. LV12 is too old to open an LV17 snippet.
I saved the snippet, brought it into a VI, then back saved the VI to LV12.
It will be broken because it has a typedef for the statemachine enum. But you can disconnect from typedef. Then save that enum as a new typedef control. And change all the other instances to your newly saved control.