Example projects
The IAR Visual State product package comes with a number of different example designs and sample applications, as well as reusable code examples for things like events queues and using the IAR Visual State API. This page provides a brief overview and description of each example as well as pointers to example-specific documentation. The examples are divided into these sections:
- A CD player example
- A mobile phone call control design
- Using the C++ API
- Hardware-independent example code
A CD player example
This is an example model showing a simplified CD player. The example is available in two versions:
-
A simplified model with several C and C++ implementation projects for different implementation environments. The implementations share code as far as possible with only small target-specific adaptations.
- Open a copy of the workspace in the IAR Visual State Editor.
- Browse the files on disk.
- The documentation includes a simple 4-step procedure on how to get up and running with the example. Additional steps show how you can make changes to the model logic and immediately test them.
- Several IAR Embedded Workbench projects for different architectures, including ARM, AVR, MSP430, AVR32, and STM8.
- A Cygwin/gcc based console project that plays your CD's on your PC's CD drive.
- A Microsoft Visual Studio console project that plays your CD's on your PC's CD drive.
- A Microsoft Visual Studio GUI project that plays your CD's on your PC's CD drive.
-
A slightly more complex CD player model.
- Open a copy of the workspace in the IAR Visual State Editor.
- Browse the files on disk.
- There are also example source files in the hardware-independent example code section showing how to turn this model into a running application.
A mobile phone call control design
This example is a very simplified handset design that shows how call control can be implemented as a graphical state machine.
Hardware-independent example code
This is a collection of more or less hardware-independent source files and sample models.
-
AVSystemSampleCode
This directory contains files needed to turn the CD Player model into a runnable application. The code is hardware-independent and can be run in any execution environment that supports printf/scanf I/O. Read more here. -
C++ model using the C++ API.
Features shown in this model:- A complete application for IAR Embedded Workbench for ARM version 7.40.4
- Using C++ code generation from the IAR Visual State Coder
- Using a simple event queue
- Using namespace in the generated C++ code
- Open IAR Embedded Workbenck workspace for ARM version 7.40.4.
- Open IAR Visual State Editor workspace
-
GenericSampleCode
This directory contains an example implementation of an event queue that can be used as is in many cases and for quick prototyping.
Source files -
TCPIPSampleCode
An example TCP/IP implementation for use with the RealLink debug facility.
RealLink is a general mechanism for feeding state machine debug information from the target application back to the Validator. This mechanism can be very useful if the target hardware lacks support for C-SPY® debugging or when the application is prototyped on PC hardware for example.
However, a hardware platform-specific communications channel must be implemented. A typical choice is to use a serial port, but sometimes a TCP/IP channel is better suited. This example shows how the TCP/IP communication can be set up in a Windows environment.
More information on Reallink use is available in part 6 of the IAR Visual State user guide.
Source directory