Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #31635
| From | Bill Davy <Bill@XchelSys.co.uk> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Text on FSM |
| Date | 2023-03-10 08:37 +0000 |
| Message-ID | <k708ipFq7ktU1@mid.individual.net> (permalink) |
| References | <ba8e4635-0eb1-4a92-99a7-e6bf7ba67e14n@googlegroups.com> <tue3k0$1mrq0$2@dont-email.me> |
On 10/03/2023 02:11, Don Y wrote: > On 3/9/2023 3:17 PM, jmariano wrote: >> Hello Does anyone know of a nice text on finite state machines and their >> software implementation on embedded systems? > > Implementations can vary widely. Do you want to present (current state, > inputs) to a machine and have (next_state, outputs) emitted "immediately"? > Or, is the processing time not critical (e.g., UI's tend to be this type) > > Do you want to limit the machine to the "classic" design? Or, add > extensions (e.g., support the notion of "previous_state", "subroutines", > etc.)? > >> I'm looking for some theoretical background and design methodology. A few >> examples of "C" implementation would be a nice but not really needed. I'm >> not looking for a recipe or code but for a more formal explanation on the >> workings of FSM. Thanks jmariano > > In the degenerate case, you build a matrix that is accessed by > [state][inputs] > and delivers (next_state, outputs). But, it's obvious that the size of > this structure grows quickly with number of states and inputs. In > practice, > often a state may have only a few significant inputs that govern the choice > of next state so the matrix contains lots of redundant entries. > > You can unfold the matrix into a series of switch/case statements -- but, > I've found that makes it hard to sort out what's really happening (the > beauty of a state machine is that it is concise). > > I prefer representations like: > > Case IDLE > On <digit> GoTo ACCEPTING Executing GobbleDigit() > On <clear> GoTo ISSUE_PROMPT Executing ClearValue() > On <enter> GoTo TEST_VALUE Executing CheckLimits() > .. > > Note that there are only 3 items encoded on each line: > - the input being examined > - the name of the intended next_state > - the action to be performed *in* the transition > As such, this can be encoded in as few as 3 bytes (depending on how > many states, inputs, and actions you need to support) > > But, the big advantage is it's concise -- no extra syntactic sugar > to clutter up the page (cuz you want to express the machine in > as little space as possible as it gets harder to chase layers of > case/switch statements with interspersed *actions*) > > [There are also UML techniques for their representation and tools that will > parse such descriptions and build the code for you] > > In school, Hill & Peterson was our reference (_Intro to Switching Theory > and > Logical Design_) but you don't need much "text" to understand the concepts > (assuming you already understand logic). > > OTOH, it's worth learning about minimization techniques -- esp if your > approach to the machine's design is /ad hoc/ (ripe for hidden > optimizations). > I went to a course of lectures on (and by) Harel state-charts. Here is one for text: https://github.com/cepsdev/machines4ceps There is also https://www.codeproject.com/Articles/11398/A-Lightweight-Implementation-of-UML-Statecharts-in
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Text on FSM jmariano <jmariano65@gmail.com> - 2023-03-09 14:17 -0800
Re: Text on FSM Rick C <gnuarm.deletethisbit@gmail.com> - 2023-03-09 16:52 -0800
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-09 19:11 -0700
Re: Text on FSM Bill Davy <Bill@XchelSys.co.uk> - 2023-03-10 08:37 +0000
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 03:50 -0700
Re: Text on FSM pozz <pozzugno@gmail.com> - 2023-03-10 09:54 +0100
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 04:17 -0700
Re: Text on FSM Robert Roland <fake@ddress.no> - 2023-03-10 12:48 +0100
Re: Text on FSM Rick C <gnuarm.deletethisbit@gmail.com> - 2023-03-10 07:20 -0800
Re: Text on FSM pozz <pozzugno@gmail.com> - 2023-03-13 16:35 +0100
Re: Text on FSM StateMachineCOM <statemachineguru@gmail.com> - 2023-03-13 08:55 -0700
Re: Text on FSM pozz <pozzugno@gmail.com> - 2023-03-14 15:44 +0100
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-13 09:29 -0700
Re: Text on FSM pozz <pozzugno@gmail.com> - 2023-03-14 15:54 +0100
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-14 08:39 -0700
Re: Text on FSM Niklas Holsti <niklas.holsti@tidorum.invalid> - 2023-03-14 18:49 +0200
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 09:39 -0700
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 10:02 -0700
Re: Text on FSM Ed Prochak <edprochak@gmail.com> - 2023-03-10 10:10 -0800
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 12:10 -0700
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 12:49 -0700
Re: Text on FSM Ed Prochak <edprochak@gmail.com> - 2023-03-10 14:02 -0800
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-11 06:01 -0700
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-11 06:17 -0700
Re: Text on FSM StateMachineCOM <statemachineguru@gmail.com> - 2023-03-10 07:54 -0800
Re: Text on FSM jmariano <jmariano65@gmail.com> - 2023-03-10 09:51 -0800
Re: Text on FSM Rick C <gnuarm.deletethisbit@gmail.com> - 2023-03-10 11:27 -0800
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-10 12:46 -0700
Re: Text on FSM Ed Prochak <edprochak@gmail.com> - 2023-03-10 13:11 -0800
Re: Text on FSM Gerhard Hoffmann <dk4xp@arcor.de> - 2023-03-13 21:20 +0100
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-13 15:41 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-13 23:07 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-13 22:59 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-14 21:29 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-14 19:40 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-22 16:37 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-22 18:15 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-26 00:45 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-26 03:35 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-27 02:32 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-27 01:16 -0700
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-28 15:25 -0400
Re: Text on FSM Don Y <blockedofcourse@foo.invalid> - 2023-03-28 16:56 -0700
Re: Text on FSM Clifford Heath <no.spam@please.net> - 2023-03-27 16:18 +1100
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-28 11:17 -0400
Re: Text on FSM Clifford Heath <no.spam@please.net> - 2023-03-29 09:00 +1100
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-28 21:27 -0400
Re: Text on FSM Clifford Heath <no.spam@please.net> - 2023-03-30 08:33 +1100
Re: Text on FSM Richard Damon <Richard@Damon-Family.org> - 2023-03-28 21:31 -0400
Re: Text on FSM George Neuner <gneuner2@comcast.net> - 2023-03-10 16:49 -0500
csiph-web