wiki:news:10oct2013
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
wiki:news:10oct2013 [2013/09/21 18:58] – [Putting all Things Together] pmueller | wiki:news:10oct2013 [2021/04/18 13:42] – pmueller | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Multiple instances of the same machine ====== | ====== Multiple instances of the same machine ====== | ||
- | Sometimes you want to run the same state machine multiple times. E.g. processing | + | Sometimes you want to run the same state machine multiple times. E.g. processing |
- | Luckily in C there there is also a well known concept to do this. Instead of defining objects you define | + | Luckily in C there is also a well known concept to do this. Instead of defining objects you define |
In this example we will show you how to " | In this example we will show you how to " | ||
Line 23: | Line 23: | ||
You can now simply declare multiple variables of type TESTCASE_INSTANCEDATA_T which contains the data per instance. When calling the state machine just point to one of these variables. | You can now simply declare multiple variables of type TESTCASE_INSTANCEDATA_T which contains the data per instance. When calling the state machine just point to one of these variables. | ||
- | To let the state machine | + | Sometimes it is necessary that a state machine |
<code c> | <code c> | ||
Line 50: | Line 50: | ||
===== Provide an own Instance Structure ===== | ===== Provide an own Instance Structure ===== | ||
- | Sometimes it makes sense to provide an own instance structure. In our example we want to store the baud rate, parity and other values relevant for each serial port. So the state machine can store there all local data and makes it " | + | Sometimes it makes sense to provide an own instance structure. In our example we want to store the baud rate, parity and other values relevant for each serial port. |
- | So first define an own struct in a file called '' | + | So first define an own struct in a file called '' |
<code c> | <code c> | ||
Line 112: | Line 112: | ||
Coming back now to the example of three serial interfaces. The following figure shows a simplified state machine for handling a serial interface. The state machine is generic. Whether COM0 or COM1 or COM2 is processed is determined only from the content of the instance variable. And also other parameters are stored there and of course the local machine variables. | Coming back now to the example of three serial interfaces. The following figure shows a simplified state machine for handling a serial interface. The state machine is generic. Whether COM0 or COM1 or COM2 is processed is determined only from the content of the instance variable. And also other parameters are stored there and of course the local machine variables. | ||
+ | {{: | ||
+ | I hope that the concepts how to run multiple state machines of the same type are clearer now. And also how to define an own instance structure that is necessary for more complex machines. | ||
- | I hope that the concepts how to run multiple state machines | + | In case of any questions don't hesitate |
- | In case of any questions don't hesitate to contact us! | ||
- | {(rater> | ||
~~DISCUSSION|Leave your comments~~ | ~~DISCUSSION|Leave your comments~~ |
wiki/news/10oct2013.txt · Last modified: 2022/08/17 19:44 by pmueller