Stamp PLC - Javelin Sample Code: StampPLC.java
Dan Harris
Posts: 25
I am new to the Javelin Stamp and a beginner on the Stamp PLC.·
I was using the Stamp PLC with the BS2 and that sample code worked no problem, it reported the current value of the 4 analog digital converters.·
When I read through the Javelin stamp plc sample code, it looked like it would do the same thing, but when i run it, it says that it compiled successfully, then the Javelin Terminal box pops up with the below message:
Example Program:· TerminalTest.java
Location:············ Projects directory
Welcome to the simple command
processor.
Click the field at bottom of this
window, and enter a command.
Valid Commands are:
···· help - print this message
··· clear - clear the screen
··· bell - sound the bell
····flash - perform a simple animation
>
A few seconds later, an error message shows up in a window at the bottom of the Javelin Stamp IDE that says:
[noparse][[/noparse]error IDE-0022} Error reading from the serial port (timeout).
It does not let me make a selection, presumably because it timed out.
I was looking through the sample projects that get loaded onto the C drive when the javelin stamp IDE is installed and this·appears to be the same as TerminalTest.java
Do I have something wrong with my settings that could be causing the IDE to download the wrong program onto the Javelin Stamp.·
And is it likely a different problem that is causing it to timeout.
I have no problems with the sample Stamp PLC code for the Basic Stamp.
Please help,
Dan Harris
·
I was using the Stamp PLC with the BS2 and that sample code worked no problem, it reported the current value of the 4 analog digital converters.·
When I read through the Javelin stamp plc sample code, it looked like it would do the same thing, but when i run it, it says that it compiled successfully, then the Javelin Terminal box pops up with the below message:
Example Program:· TerminalTest.java
Location:············ Projects directory
Welcome to the simple command
processor.
Click the field at bottom of this
window, and enter a command.
Valid Commands are:
···· help - print this message
··· clear - clear the screen
··· bell - sound the bell
····flash - perform a simple animation
>
A few seconds later, an error message shows up in a window at the bottom of the Javelin Stamp IDE that says:
[noparse][[/noparse]error IDE-0022} Error reading from the serial port (timeout).
It does not let me make a selection, presumably because it timed out.
I was looking through the sample projects that get loaded onto the C drive when the javelin stamp IDE is installed and this·appears to be the same as TerminalTest.java
Do I have something wrong with my settings that could be causing the IDE to download the wrong program onto the Javelin Stamp.·
And is it likely a different problem that is causing it to timeout.
I have no problems with the sample Stamp PLC code for the Basic Stamp.
Please help,
Dan Harris
·
Comments
It never says hello world.
Maybe my IDE is not setup right?
I am using a Dell Precision 390 with WXP, with 1 serial port.
I assume that is an onboard serial port (DB9 male connector), not an
usb to serial converter module. Right?
Check the Javelin IDE version number.
Help->About.
It should be 2.0.3
If you installed the Javelin IDE from a supplied CDROM,
please download the latest IDE here:
http://www.parallax.com/ProductInfo/Microcontrollers/JavelinDownlads/tabid/443/Default.aspx
and install it.
regards peter
Yes, this is an onboard serial port.
I was already using the most recent IDE, version 2.0.3 Build 0
I just downloaded and installed it last week.
Can you think of anything else it might be?
Thanks, Dan
Project->Identify and/or Project->Test connection
It should show YES on loopback, even if you get a timeout.
If it does not show loopback then there must be something
with your serial cable. Best to have a 1:1 straight cable
with all pins connected (9 wires). If that cable works for
your BS2, the cable is allright.
Also check if you didn't put in the javelin backwards.
There is '1' printed on the javelin module on the top left
corner. This identifies pin 1.
regards peter
·
The cable does work fine for the BS2.
and I have the chip in right, the gold colored '1' is on the top left.
I have tried Identify and Test connection.
for identify it says:
Port: COM1
Device Type: Javelin
Version: $50
Loopback: Yes
Echo: Yes
Got Status: Yes
for test connection is says:
Javelin found on COM1 (in a popup box)
and in the lower pane of the IDE, it says:
[noparse][[/noparse]Debug] TSXComm::AutoChoosePort
Testing port: COM1
Found connected Javelin Stamp, now testing for power
Resetting
TSXComm::QueryStatus
TSXComm::SendCommand(1)
TSXComm::AutoChoosePort - successful
Received data on serial port
TSXComm::Got kComStartLoad
Received data on serial port
TSXComm::Got kComStartLoad
Received data on serial port (then it displays this message a couple hundred times)
And that same Javelin terminal window pops up that gives the 4 options: help, clear, bell, flash
had a message with· options help, clear, bell, flash.
I also do not recall ever seeing such an item in the IDE sources.
A free program (Quick Screen Capture) to capture your desktop is here:
http://www.etrusoft.com/
According to your debug info, the javelin is found and operating.
What OS are you running. The IDE is not tested on Vista.
regards peter
I attached a·print screen of my screen to this post
I installed the latest version of the IDE on a coworkers computer, then sent the helloworld program to the javelin on the BOE, and it seemed to work.
Took the BOE back to my PC, and sent a different program to the javelin and it still ran helloworld.
On the other computer, i modified helloworld to display a unique text quote, and it did on the other computer. When i went back to my PC, I programmed and ran helloworld, and the same unique text appeared.
So it seems that there isn't anything wrong with the Javelin or the BOE or probably the Stamp PLC, it must by have to do with the IDE or the COM port or something else to do with my PC.
it seems that from my PC, the IDE cannot send any new programs, but it is capable of running whatever program is already loaded onto the Javelin. So that terminal test dialogue box that showed up must have been what was loaded onto the Javelin when it was shipped to me.
Is there any specific issue that would cause these symptoms? I really need to be able to use the Javelin from my PC.
Thanks
Dan
Dan,
Something strange just happened.
When I opened TerminalTest.java I got an error 0050, error opening project file.
So I went into folder projects and discovered there was a TerminalTest.jpf file.
I deleted that file and now TerminalTest.java loads without error.
I don't think it has any bearing on your issue, but just in case, delete TerminalTest.jpf
Can you check your port settings in device manager. Being a normal com port I
don't expect latency settings are present for that port, but if they are,
set them to minimum. It appears you cannot download a new program
from your system.
As an alternative you can try JavelinDirect. That is a commandline utility that
also can program the javelin.
You can find JavelinDirect here:
http://tech.groups.yahoo.com/group/JavelinCode/files/JavelinDirect/
The zip includes a standalone executable.
If you happen to have a usb2ser cable, you can also give that a try.
regards peter
I tried it on an older Windows 2000 machine and everything worked fine.
I'm not sure if this would have caused any trouble, but before I could even run the Javelin IDE, I had the same error described in the following post:
http://forums.parallax.com/showthread.php?p=644354
I folllowed the link and installed the Microsoft hotfix.
On the 2 older PCs that I tried the Javelin with the BOE and had success, one was a W2000 machine, and the other was a windows XP, but it hadn't been turned on in·9 months so it wouldn't have had the latest updates.· But on both of these machines, the Javelin IDE worked without installing the hotfix.
Maybe the hotfix didn't fully fix the issue and that's what my problem is.
Any ideas on this?
No problems whatsoever.
As I suggested in an other thread for another problem, you can startup xp in safe mode
and the Javelin Stamp IDE program (version 2.0.3) should run.
Try if you can download a new program from safe mode,
just to find out.
regards peter
I did not have a TerminalTest.jpf file in the projects folder
I attached a print screen of my com port settings.· Under advanced I currently have the FIFO buffers on high, but i have tried them on low and on off.
To check if it was the windows hotfix that is causing this, i just did a system restore to the point before i installed the hotfix, then i reinstalled the Javelin IDE and moved that HHCTRL.OCX into the IDE folder instead of reinstalling the hotfix.· This allowed the IDE to open ok, but when i try to send programs to the Javelin it works the same way.·
I will try safe mode now
I suggested it in the other thread where the problem·is that the
message window will not show. No need for a javelin connection there.
So for now this issue remains a mystery.
regards peter
Have you searched the Dell website for drivers specific for your laptop model
and XP? The BS editor and Javelin IDE are written with different software
tools, so that could explain why you have no issues with BS.
regards peter
After programming the javelin, close the IDE and
startup JideWinTerminal. Connect to the same com port
that was used by the Javelin IDE program.
Click start to connect to the javelin. You can click reset
to reset the javelin. Messages should appear and you
can send text to the javelin just as you could with the
IDE message window.
This JideWinTerminal program however is programmed
with Visual C# which is different from Borland·C++ builder.
Let me know if this does allow you to communicate
with the javelin.
regards peter
when i run the winterm program and hit start, then reset, it runs the program that was last downloaded onto the Javelin which was the demo program "hello world", so a second after I hit reset, in the JideWinTerm, the message "Hello World!<0x0D>" appears in the JideWinTerm window.
So the javelin must be recieving the reset command from the JideWinTerm, and the JideWinTerm is recieving data from the Javelin because it printed the hello world message.
Thanks, Dan
The javelin is reset by toggling the com port DTR pin,
not by a command.
You should program TerminalTest into the javelin
and then try again. We know the javelin can send
but I wonder if it can receive.
regards peter
Below is what happend with the Win Terminal with Javelin programmed with terminaltest.java.
I sent flash, then bell, then help to it. So does this mean that my computer is communicating ok with the javelin and it's the IDE that's having the problem talking to the Javelin?
Thanks, Dan
<0x10>Welcome to the simple command processor
<0x0D>
Valid commands are:<0x0D>
help - print this message<0x0D>
clear - clear the screen<0x0D>
bell - sound the bell<0x0D>
cmd - print the command prompt<0x0D>
flash - perform a simple animation<0x0D>
>
-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03>-<0x03>/<0x03>|<0x03>\<0x03><0x08>
>
<0x07>
>
Valid commands are:<0x0D>
help - print this message<0x0D>
clear - clear the screen<0x0D>
bell - sound the bell<0x0D>
cmd - print the command prompt<0x0D>
flash - perform a simple animation<0x0D>
>
Windows says that the program closed abnormally.
here is the details provided by windows:
AppName: javelin stamp ide.exe AppVer: 2.0.3.0 ModName: kernel32.dll
ModVer: 5.1.2600.3119 Offset: 00012a5b
If i open the Javelin IDE, then close it without using it, it closes without issue.
The communication appears to be working using JideWinTerminal.
Please try this (close JideWinTerminal):
Startup IDE beta, and then do Debug->Messages. The messagewindow appears.
Then click on the reset button of the message window.
This should reset the javelin and the screen with 4 options should appear.
Now try if you can send flash, bell, help
Let me know what happens.
regards peter
I found a beta download on one of your other posts, but i don't know if it's the most recent.· It was a zip file of just the .exe file, so I put it in the directory I had for 2.0.3 IDE and ran it.··It's version 2.2.0, build 0.
I went to debug-messages, and the window comes up and hit reset, and get the·list of 4 options, but when i type in any of the choices and hit enter, nothing happens.
That proves there is something on your PC that prevents
communication via Borland C++. I shall go to some forums to find if there
are Borland C++ 6.0 issues with winxp.
Also the error you got when closing version 2.0.3
after using it, that is not right. Perhaps you should try
the hotfix again ( I believe you undid that).
For now, you can use JideWinTerminal for debug output.
Just remember to print only \n and not \r\n, that way <0x0D>
should not appear.
regards peter
It seems that older machines work fine with it, I tried a Dell Dimension 8200 and it worked fine.
I tried 2 newer Dell Optiplex 320s and they both had the same issue I'm having.
Has anybody got the Javelin IDE to work on either a Dell Precision 390 desktop, or a Dell Optiplex 320 Desktop?
Maybe it's something to do with these particular systems being incompatible.
I just noted something (IDE beta):
In terminaltest, the commandstring is assembled up to \r.
I believe getChar returns \n when you enter text in the textfield.
Try the keypress field. That should send a \r when you press enter
(click in keypress field, then type help<ENTER>)
Let me know what happens.
regards peter
I just wanted to step in and ask Dan if he is running any kind of Palm-Pilot/PDA software such as Hot-Sync/Active-Sync on the PC? These programs tend to interfere with serial communications and it does seem that there’s some sort of interference here. If we cannot identify it, the most we can do is have the module sent in for testing here to confirm its functionality and communication. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
I am not running any of those sort of devices on my machine. The only peripheral is a USB laser printer.
My IT guy here suggested I check the "services" administrative tool to check for the active sync service, but it was not running on my PC.
i would assume that the Javelin Stamp is likely good because it works on the older PCs in my office, just not on the new ones.
One thing here that might be unique to our office is that we are running novell clients on all machines to interface with an older server. Do you think this could cause the problem?
Try attached modified terminaltest program.
That displays all received bytes as hexcodes.
regards peter