LabVIEW – State Machines Gary Boorman Finite State Machine I •A Finite State Machine (FSM or State Machine) is a behavioural model used to design computer programs. •It is composed of a finite number of states associated with transitions. •A transition is a set of actions that starts from one state and ends in another (or the same) state. •A transition is started by a trigger, and a trigger can be an event or a condition. Post-Grad LabVIEW Course G Boorman 2 Finite State Machine II Post-Grad LabVIEW Course G Boorman 3 Simple SM Implementation •Uses a While loop with Shift Register, Case Structure and Enum Post-Grad LabVIEW Course G Boorman 4 Finite State Machine III •State Machines are extremely useful in Control, DAQ and Analysis systems •Easily constructed in Labview •Easily scaled to larger state machines – more states, choice of next-state Post-Grad LabVIEW Course G Boorman 5 Simple Traffic Light FSM FSM operates to defined pattern Traffic waiting? Red red:T; amber:F; green:F Timer=3s Amber RedAmber r:F; a:T; g:F Start Timer r:T; a:T; g:F Start Timer Green Timer=2s r:F; a:F; g:T Start Timer Timer=20s Post-Grad LabVIEW Course G Boorman 6 Simple Traffic Light FSM •FSM has a choice of next state Red r:T; a:F; g:F Run Normal Amber Run Backwards Green r:F; a:T; g:F Start Timer Timer=20s r:F; a:F; g:T Start Timer Post-Grad LabVIEW Course G Boorman 7
© Copyright 2026 Paperzz