EXAMPLE PROJECTS
The visualSTATE 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 visualSTATE 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 CD player example with Altia Design prototyping support
- A mobile phone call control design
- Board support and example applications for specific hardware
- Using the C++ API
- Hardware-independent example code
The Examples
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. The following environments are available:
- Several IAR Embedded Workbench projects for different architectures, including ARM, AVR, MSP430, 78K, AVR32, SH 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.
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.
You can open the workspace in the visualSTATE Navigator. - A slightly more complex CD player model. You can find the example files here. Open the workspace in the visualSTATE Navigator and play around with the design in the Designer and the Validator state machine simulator. There are also example source files in the hardware-independent example code section showing how to turn this model into a running application.
A CD player example with Altia Design prototyping support
This is the same example as the second example above, but it is augmented with a prototype 'front panel' that emulates the user interface of a car CD player that can be manipulated on-screen to exercise the state machine model, including graphically inserting and ejecting the compact disc! The front panel is created with Altia Design. Such a front panel design can optionally be code generated for virtually any LCD based embedded system. The example uses a free Altia run-time engine that lets you run the example, but not modify the front panel design. If you want to try the full Altia tool suit, you can visit Altia's web site to get your own evaluation version of the toolset.
The example files can be found here and example-specific documentation can be found here. You can open the workspace in the visualSTATE Navigator.
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. The example files can be found here.
You can open the workspace in the visualSTATE Navigator.
Board support and example applications for specific hardware
Currently there are twelve board-specific applications serving as both example applications and as
board support packages showing how the visualSTATE API can be used on specific hardware. The examples show how
for instance interrupts from peripherals like buttons and timers can be fed as events to a state machine design in an easy manner.
All these examples are created for specific hardware and specific versions of IAR Embedded Workbench, but by examining the code, code idioms can
easily be reused. Especially the main-loop code and event queue code is very similar for all examples.
All hardware examples also show how the C-SPYLink plug-in enables true graphical state machine debugging.
For each example a link is provided to the example documentation and it is noted if the example has any special properties.
- Texas Instruments eZ430-Chronos kit example
An example for the eZ430-Chronos wrist watch that implements selected parts of the sports watch functionality.
This example also shows the build integration between IAR Embedded Workbench
and visualSTATE.
Documentation
You can open the workspace in the visualSTATE Navigator.
- Texas Instruments eZ430-Chronos kit Small example
An example for the eZ430-Chronos wrist watch that implements a minimal state machine to control a stop watch on the sports clock.
This example also shows the build integration between IAR Embedded Workbench
and visualSTATE. The example is sized for the the KickStart version of IAR Embedded Workbench for msp430 and the 20-state limited demo version of visualSTATE
Documentation
You can open the workspace in the visualSTATE Navigator.
- 78K0R_Cool-it
Example for the NEC Cool-it evaluation board for the 78K0R from NEC. This example also shows the build integration between
IAR Embedded Workbench and visualSTATE.
Documentation
You can open the workspace in the visualSTATE Navigator.
- 78K0R_Saveit
Example for the NEC Save-it evaluation board for the 78K0R from NEC. This example also shows the build integration between
IAR Embedded Workbench and visualSTATE. The model implements a reaction time measurement application that can measure
and average your reaction times over a set of trials. The example also shows how any number of timer action functions can
be mapped to a reusable software timer implementation that is only dependent on being called periodically, for example from a hardware timer interrupt
or any task or function that occurs periodically.
Documentation
You can open the workspace in the visualSTATE Navigator.
- Stm32f10
Example for IAR KickStart Kit for the STM32 Cortex-M3 from ST.
Documentation
You can open the workspace in the visualSTATE Navigator.
- STR912FKickStartPowerPac
Example for IAR KickStart Kit for the STR9F ARM9 from ST. This example is built on IAR Embedded Workbench for ARM 4.42 and also utilizes
the IAR PowerPac RTOS. The application shows the easy integration of the visualSTATE API and an RTOS.
Documentation
You can open the workspace in the visualSTATE Navigator.
- STR730KickStart
Example for IAR KickStart Kit for the STR730 ARM7 from ST.
Documentation
You can open the workspace in the visualSTATE Navigator.
- LPC214xKickStart
Example for IAR KickStart kit for the LPC 2148 ARM7 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
- LPC213xKickStart
Example for IAR KickStart Kit for the LPC 2138 ARM7 from NXP. This example demonstrates the build integration
between IAR Embedded Workbench and visualSTATE, where a visualSTATE project can be made part of an IAR Embedded Workbench project. This feature
makes the visualSTATE code generator an integrated part of the IAR Embedded Workbench build chain, so that the code generator will be executed as part of a build/make if needed.
The IAR Embedded Workbench project is set up so that it is easy to switch between table-based code and switch/if -based code.
Documentation
You can open the workspace in the visualSTATE Navigator.
- avrm128stk500
Example for the Atmel evaluation system STK500 for the AVR 8-bit CPU.
Documentation
You can open the workspace in the visualSTATE Navigator.
- CarLightR8C23
Example for the Renesas StarterKit evaluation board for the R8C23 from Renesas.
Documentation
You can open the workspace in the visualSTATE Navigator.
- AT91SAM7xKickStart
Example for the Atmel evaluation board for the AT91SAM7 ARM7 from Atmel.
Documentation
You can open the workspace in the visualSTATE Navigator.
- IAR LPC1114 KickStart kit example
Example for the IAR KickStart kit for the lpc1114 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
- IAR LPC1343 KickStart kit example
Example for the IAR KickStart kit for the lpc1343 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
- MSP430 Experimenters Board
Example for the MSP430 Experimenter's board.
Files can be found here
You can open the workspace in the visualSTATE Navigator.
Using the C++ API
This is an example that shows how to use the C++ code generation feature for table-based code. The example is generic and only requires a
C++ compiler to build. The source files are accompanied by a build project for IAR Embedded Workbench for ARM version 5.xx, but
are completely hardware-independent. The example also shows how some of the additional API functions like SEM_name() can be used.
An application note in PDF format describes the example and also discusses some additional features of the C++ version of the API.
Documentation
You can open the workspace in the visualSTATE Navigator.
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. Follow the instructions in the
readme file.
- 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
- LEDSampleCode
This example is a minimal LED blinking application, originally written for Atmel AVR, but
small enough to be easily ported to any hardware. Follow the instructions in the
readme file.
You can open the workspace in the visualSTATE Navigator.
- 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 visualSTATE user guide.
Source directory
An example for the eZ430-Chronos wrist watch that implements selected parts of the sports watch functionality. This example also shows the build integration between IAR Embedded Workbench and visualSTATE.
Documentation
You can open the workspace in the visualSTATE Navigator.
An example for the eZ430-Chronos wrist watch that implements a minimal state machine to control a stop watch on the sports clock. This example also shows the build integration between IAR Embedded Workbench and visualSTATE. The example is sized for the the KickStart version of IAR Embedded Workbench for msp430 and the 20-state limited demo version of visualSTATE
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the NEC Cool-it evaluation board for the 78K0R from NEC. This example also shows the build integration between IAR Embedded Workbench and visualSTATE.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the NEC Save-it evaluation board for the 78K0R from NEC. This example also shows the build integration between IAR Embedded Workbench and visualSTATE. The model implements a reaction time measurement application that can measure and average your reaction times over a set of trials. The example also shows how any number of timer action functions can be mapped to a reusable software timer implementation that is only dependent on being called periodically, for example from a hardware timer interrupt or any task or function that occurs periodically.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for IAR KickStart Kit for the STM32 Cortex-M3 from ST.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for IAR KickStart Kit for the STR9F ARM9 from ST. This example is built on IAR Embedded Workbench for ARM 4.42 and also utilizes the IAR PowerPac RTOS. The application shows the easy integration of the visualSTATE API and an RTOS.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for IAR KickStart Kit for the STR730 ARM7 from ST.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for IAR KickStart kit for the LPC 2148 ARM7 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for IAR KickStart Kit for the LPC 2138 ARM7 from NXP. This example demonstrates the build integration between IAR Embedded Workbench and visualSTATE, where a visualSTATE project can be made part of an IAR Embedded Workbench project. This feature makes the visualSTATE code generator an integrated part of the IAR Embedded Workbench build chain, so that the code generator will be executed as part of a build/make if needed.
The IAR Embedded Workbench project is set up so that it is easy to switch between table-based code and switch/if -based code.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the Atmel evaluation system STK500 for the AVR 8-bit CPU.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the Renesas StarterKit evaluation board for the R8C23 from Renesas.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the Atmel evaluation board for the AT91SAM7 ARM7 from Atmel.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the IAR KickStart kit for the lpc1114 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the IAR KickStart kit for the lpc1343 from NXP.
Documentation
You can open the workspace in the visualSTATE Navigator.
Example for the MSP430 Experimenter's board.
Files can be found here
You can open the workspace in the visualSTATE Navigator.
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. Follow the instructions in the readme file.
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
This example is a minimal LED blinking application, originally written for Atmel AVR, but small enough to be easily ported to any hardware. Follow the instructions in the readme file.
You can open the workspace in the visualSTATE Navigator.
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 visualSTATE user guide.
Source directory