F. Wagner November 2005
StateWORKS IO-Unit for
Velleman K8055 (or VM110) boards
The K8055 board
The Velleman K8055 USB experiment interface board has the following inputs and outputs:
- 5 digital inputs (with test buttons provided on the boards)
- 2 analog inputs (with test potentiometers provided on the board)
- 8 digital outputs (with LED indicators provided on the board)
- 2 analog outputs (as voltage signals and as PWM, with LED indicators provided on the board)
In addition the board contains two 16-bit counters triggered by inputs I1 and I2 (the debouncing control is provided).
The detailed description of the board can be found, for instance, at www.velleman.be. It is readily available from distributors in many parts of the world, either as the K8055 kit for assembly yourself, or as the assembled VM110 module.
The StateWORKS IO-Unit
The K8055Unit is a Unit for the board which can be used with a StateWORKS execution system containing an I/O Handler connecting to K8055_c.dll. In StateWORKS we use the term Unit for a device in which several inputs and outputs may be accessed, as a group. The Unit provides a fairly complete set of functionality covering opening and closing of the board, access and control of inputs, outputs and counters. 4 alarms are provided for erroneous situations. The polling time for inputs can be set (default value equals 100 msec).
The address of the K8055 boards may have a value 0...3 (set by jumpers): Thus, up to 4 boards may be linked to the USB ports of one PC. Please use address 0 - both jumpers SK5 and SK6 installed.
K8055demo project
A K8055demo project shows the use of the I/O-Unit in a StateWORKS project. The project contains two state machines Comb_Loc1 and Lights.
The state machines Comb_Loc1 is the state machine used in our "Getting started" document. The potentiometer on the analog input A2 simulates the knob on the front of a safe.
The state machine Lights is of course provided as any demo with LEDs has it. The state machine is a kind of counter switching sequentially the output LEDs. The button at input I1 is used to Start or Stop the lights. To make it more attractive the speed can be changed by means of the analog input A1 (using, for instance, the potentiometer on the board).
The use of the demo package
The demo package contains the execution system (SWExec.exe), the K8055_c.dll and the project K8055demo in one Zip file. Download that, and unzip it to a suitable directory. In order to use our lovely monitor - SWMon - you will also need to download and install StateWORKS Studio - the LE version is free for 30 days, and inexpensive after that. Go to www.stateworks.com for all this software. You might find it convenient to do this installation first, and then unzip your demo package files into a directory created in the StateWORKS Studio "Projects" directory: typically C:\Program Files\SWSoftware\StateWORKS Studio LE 6.0\Projects.
Connect the K8055 board to your PC: it will take its power from the USB cable. Ignore the Microsoft Windows notice about the new hardware being found: it will go away.
Start the SWExec.exe program. It will ask for the location of a project file, the first time it runs, and you should give the full path of "K8055demo.swd" where the demo package places it.
Start the SWMon program (either from the SW Studio I.D.E. or by finding SWMon.exe) to be able to see all states and the outputs displayed in real time. The program will show the default "Host" and "Port"which you should accept. Then, through the menu path Select -> Objects you can find a list of all of the objects in this project, so select them all and copy the list to the right-hand window.
To test the state machine Lights:
- Start the lights pushing the button at I1 on the board.
- Change the process speed by turning the potentiometer at A1 on the board.
- Stop the lights pushing the button at I1 on the board.
- If you have started the SWMon machine you see the changes of all inputs, outputs and states of state machines.
- In SWMon you may use the commands Cmd_No_On / Cmd_No_Off to enable / disable the signalling of the process speed on the analog output DAC2 (LD10).
To test the state machine Comb_Lock1:
- If you have started the SWMon you are able to watch the values of A2.
- By turning the potentiometer at A2 on the board get the required series of values for opening the safe, by means of its combination lock.
- These four values are preset, and may be seen in the monitor by means of the four SWIP settings which it displays. The project is described in the "Getting Started"document enclosed in the SW Studio package. Note that there is a ±2 unit tolerance on each setting, just as Richard Feynman discovered when he investigated his own safe at Los Alamos.
- The unlocked safe is signalled by switching on the digital output Out1 (LD1) on the board.
For further experiments open the StateWORKS Studio I.D.E. You may now study the project and its state machines in detail. You may of course create your own projects and state machines according to your applications with the K8055 board.
No Coding Required !
You will notice, if you look carefully at the project, that there is no "source code". There are just specifications of the requirements, expressed as finite state machines. These replace the concept of source code, in C or C++, for example, to express and implement the behaviour of a software package. Although this demo project is very simple, even trivial in nature, when the same StateWORKS concept is applied to large scale projects, such as embedded systems or telecommunications, there are huge advantages to be gained in productivity, in reliability and in security of the final product. Complex code is very dangerous in such applications: we avoid it.
If you investigate StateWORKS - e.g. by reading some of the other Technical Notes or some published papers on our web site - you will find that it is very rich in features.