Shop OBEX P1 Docs P2 Docs Learn Events
Newbie Javelin question — Parallax Forums

Newbie Javelin question

BullwinkleBullwinkle Posts: 101
edited 2006-02-06 05:50 in General Discussion
I don't actually own a Javelin Stamp. I bought a BASIC Stamp with my Stampworks kick a few weeks ago. I was tempted to get a Javelin Stamp as I have a reasonable amount of Java experience.

However, there just seemed to be more "action" on the BASIC Stamp front, so I played safe. Now that I've been programming the stamp for a few weeks, I'm starting to get annoyed with BASIC. So many things you take for granted in a modern 3GL just aren't in BASIC, like parameter passing, functions (methods), threading, etc...

I have one major question regarding Java on the Stamp.

Can it support concurrency? If so, how many threads?

It seems to me that the kind of applications best suited to the Stamp just cry out for multiple execution threads, it's a natural. The big loop BASIC approach seems such a primitive way to tackle the problem of talking to multiple devices in quasi-real-time.

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-02-06 03:43
    The javelin only has 1 thread, but there are so called Virtual Peripherals: transmit and receive
    uarts (with 255 byte buffers), ADC, DAC, PWM, Timers.
    These VP's run in the background indepently from the foreground code.
    Concurrency can be implemented by using state machines.
    You can run 6 VP's simulteneously. You can have as many timers as you want
    as the Timer VP only occupies one VP slot.
    The javelin has no garbage collection but that is not really a miss.
    Just don't create local strings and arrays unless you·save references to these
    objects in global variables.

    regards peter
  • bulkheadbulkhead Posts: 405
    edited 2006-02-06 05:50
    If you download and read the manual for the Javelin (200+ pages), you will see the differences between programming in real java and the java in the javelin stamp. A lot of it goes over the basics of java programming (for example, what is an object...) but there are some useful sections on differences between standard java and the javelin, and how to make the most use of its VPs.

    Although you cant run more than 1 thread with the javelin, it does support the same functions that make java a more advanced language than basic. You can, of course, make classes, create and use objects, have references, have methods, etc. If you are doing a project that requires many tasks(that the VP's can't handle), why not use a basic stamp to control each repetitive, stamp-consuming function, and have the javelin as a central "brain" in control of it all? The small tasks would be taken care of by the basic stamps, while the decision making and more complicated algorithms could be done by the javelin. You can use uarts (a VP) to keep communication with each of the (up to 6) basic stamps at all times.

    I agree that most of the action now is happening with the basic stamp (and for that matter, all microcontrollers programmed in a basic type language,) but there is hope yet for the Javelin. I believe it will become more popular as time progresses, and more people will begin to see the merits of an object oriented style of programming. As it becomes more popular, more classes will be developed by more people for the javelin, and then we can all take advantage of the "code-reuse" that is so central to the idea of java programming.

    Post Edited (bulkhead) : 2/6/2006 5:53:07 AM GMT
Sign In or Register to comment.