Blink

JStamp Quick Start Last Modified: 2001-07-16 20:50

Summary:

Blinks the heartbeat LED on JStamp. Increments an integer each time the LED blinks. Sends the count value out Serial0 on JStamp (this is "Serial A" on the JStamp Development Station).

Tutorial:

Download the tutorial jar file. The jar file includes JBuilder and JemBuilder projects, source, class and binary files, and javadocs. Note that a jar file is just a zip file with folder information, and can be created and opened with utilities such as WinZip.

Expand the jar file (Winzip is the easy way, you can also use the Java jar tool). Use a folder name in a projects directory such as "blink". If using Winzip, check the "use folder names" option so that files are placed in subfolders underneath "blink". In my case I downloaded the blink.jar file into e:\work\blink, then expanded the files. When you are done you should have something like this:

Start JemBuilder and open the blink.ajp project file. JemBuilder stores absolute and relative path information in the ajp file, so you need to check the absolute paths and make sure they are correct for your system. Start with the Project->Output files and browse to the blink\rambuild folder. Note that when you are browsing, you need to select the folder, then click open as shown below. (If you descend into the rambuild folder and click open, JemBuilder won't know what to open -- try it both ways to understand this).

Set the output path file to correspond to the blink\rambuild folder as shown:
Now expand the JVM0 folder and be sure the items there are correct. The Main method should just be "blink", and the classpath should be the blink\classes folder.
The JemBuilder file given is set up to enable System.out on JStamp Serial A at 9600 baud. Note that JStamp Development Station (JSDS) board serial I/O is wired as DTE, so you need a null modem connection between the JSDS and a PC. To enable serial output to the JStamp UARTs, you need to check options in Project->Pin Setup 2:
You also need to set up Drivers for com1 as shown here. The JemBuilder file given is set up to enable System.out on JStamp Serial A at 9600 baud. Note that JStamp Development Station (JSDS) board serial I/O is wired as DTE, so you need a null modem connection between the JSDS and a PC.

Now verify that your Project->Properties->Runtime CLDC paths are correct
In this project we don't use an additional libraries. If we did, we'd need to check that the Tools->Libraries classpaths were correct.

Now check the project memory settings. These are all defaults, best to leave them that way for now.


Now save these project changes and click the red circular build icon, or use the Project->Build menu item. If all the paths are correct, JemBuilder will be able to use the .class file in the blink\classes folder and create the binary file needed by JStamp.

Now start Charade, select Device aJ-80 or JStamp (aJ-80), and plug the JTAG adapter into your JStamp Development Station. Apply power to it. In Charade's command window, enter the command
"cd e:\work\blink\rambuild" to change to the folder in which we just built the blink program. If you enter a "dir" command, you should see something close to this:


Since we are doing a RAM build, loading code and executing the program from JStamp RAM, be sure the Development Station swap memory jumper JP1 is installed.

Now enter the Charade command "@load.sod" or use the menu command File->execute, and browse to the load.sod file in the blink\rambuild folder. Charade should display some scripts and progress bars as code is loaded into the JStamp.


click on the Charade Run button and you should see
vm.0 charadeIO active
vm.0 heap monitor active
and the application should start running.

To poll the variable testint, type the charade command:
show map blink.testint
Charade responds with:
-> show map blink.testint
CLASS: blink (CSA: 0002b518) : 55c5ae80
FIELDS
0001a008 testint|I

Then you can enter the command:
poll 0x1a008 user int
or use the Charade menu window->poll, then click setup and enter the address 0x1a008 for the location to poll. "user int" means we are polling a user, not system field, and it is an integer data type. The poll window setup and output should look like this:

<setup & output >

You should also see the output on JStamp's serial A at 9600 baud, with a null modem cable:

Hello Tom 3326
Hello Tom 3327
Hello Tom 3328
Hello Tom 3329
Hello Tom 3330
Hello Tom 3331
Hello Tom 3332
Hello Tom 3333
Hello Tom 3334
Hello Tom 3335

Hmm, looks like I left a semi custom message "Hello Tom" in there. Oh well!