Modify example

This section describes how to make a minor modification to the visualSTATE model in the aesample. As an exercize, try to reproduce this while using any of the three Build Configurations to code generate, build and download the image in order to get a feel of the general work flow from making model modifications to get the model running on board.

For this discussion we assume that you are working with the Debug_RAM_RealLink Build configuration, that you have succeeded to follow the instructions in Building for RealLink (and prefferably also Using RealLink), that both visualSTATE Navigator and Embedded Worbench are open on the relevant workspaces (the latter no longer debugging) and you are now ready to modify functional behaviour of the application.

The intention is to change the original StateChart so that in 'Manual Mode' the use of the Left and Right joystick actions will wrap-around. Refer to section Operation to see/verify that that currently is not the case.'

In visualSTATE Navigator, select Project->Designer (F7) to open the StateChart editor. Make some 'room' in the state Manual for two new transitions between state m1 and state m4. Now use the Transition Tool (Ctrl+3) to draw these two (straight) transitions, one for each direction, by first clicking source state then destination state. Use the Ctrl key to drag 'route points' from either endpoint of a transition for better placement and right-click a transition arrow to specify Line Type as Curve. Now double-click each transition to bring up the Compose Transition dialog. In there, double-click the appropriate Event element on the right side on the right side of the dialog to add it to the Event rule at the left side (eKey_Rightt for the m4 to m2 transition, and eKey_Right for the other transition). There are many other detailed ways to accomplish an edit like this, but you should get something close to this (the modification is ate the left side, near the captured cursor):

Now, Close Designer by File->Exit and press Yes on the dialog asking if you want to Save the changes to JoyStick. Navigator may pop up a confirmation dialog asking if you want to reload the files that were edited externally. Click Reload to that. You could now Verify the changed sytem, test in in Validator, Code Generate, Document etc, but since we're pretty sure that we have not made any errors, we can simply save the Navigator file by File->Save WorkSpace (Ctrl+S), then switch to Embedded Workbench (note there that it will have flagged JoyStick.vsp as in need of compilation), and simply use Project->Debug to Compile, Download and start Debugging in one step. Use Debug->Go and check that the altered behaviour is now there...