This chapter presents the serial port example. Like the previous examples, this one is also written for the WSN430 hardware platform and it demonstrates communication through the serial port in WSim. It is a simple application that produces an echo for every character sent to its serial port 1.
To compile the example, follow the same instructions as before. For users of the Worldsens
Live CD, the folder containing this example is /opt/worldsens/examples/wsn430-serial
.
For other, go to $WSIM_FOLDER/examples/wsn430-serial
.
To execute the example users will have to follow the procedure below:
Launch an instance of the Worldsens WConsole application, as follows:
[wsn430-serial]$
wconsole
You should see this:
Launch the simulator and connect it to the previously launched WConsole instance, using the following command (expected output is included):
[wsn430-timer]$
wsim-wsn430 --serial=/dev/pts/3 wsn430-serial.elf
WSim 0.82cvs, copyright 2005, 2006, 2007 Worldsens wsim:pid:4343 wsim:log:wsim.log
Once you attach the serial console to the simulated platform's serial port 1, the application will let you switch between its two modes by typing « Z ». The two available modes are:
The top half of the user interface window presents the simulation output with grayed letters and bottom half is the local keyboard echo for the host machine. In both modes, all the text you type will be echoed by the application in the upper part of the serial console.