PDA

View Full Version : Basic Stamp 1 and Tokenizer



joekamphaus
09-07-2008, 03:43 AM
I am a programmer but am a novice at the micro controller stuff. I have been asked to
make a gui interface to control features in a BS1. As I see it this can be done one of
either 2 ways. Serial communication or using the tokenizer.dll to reprogram the eprom.
The serial cable will not always be connected. In order to use SERIN to get data from the
PC I must be able to pole serial port for data in a loop. This must have a fairly short
timeout which apparently I cannot do with the BS1. As near as I can tell I will be unable
to use the tokenizer.dll with a BS1 either.

Is there any way to do this or are my assumptions correct? Should I suggest my client upgrade to a BS2?

Thanks

Joe

Mike Green
09-07-2008, 04:01 AM
All of the Stamps are single-threaded and their I/O is unbuffered. The net result is that you can't do more than one thing at a time unless you can interleave it in some fashion. It doesn't work well for a PC to attempt to poll a Stamp for information because the Stamp can miss the serial input if it's doing something else (other than waiting for a command from the PC). The best way to handle this is for the Stamp to poll the PC for a request. Perhaps the Stamp sends a "?" when it's ready to do something, then waits at a SERIN for a request (without a timeout). The PC always sends a response, either a request for specific data or something that indicates that no request is pending. The Stamp either reads some sensor and sends a response or waits a short time, then goes back and sends another "?".

Reprogramming a Stamp using the tokenizer is very time consuming. I don't recommend it as a way to control a Stamp.

The BS1 is limited in capability. It has only 8 I/O pins, little data storage (variables) and has limited program capacity. It is very useful for simple tasks. It may be adequate for yours depending on how complex it is. A BS2 or other BS2xx is much more capable. They're faster, have more I/O pins (16 or 32), more built-in features, more data storage, and more program storage.

joekamphaus
09-07-2008, 04:29 AM
Yes that is a problem. Since the PC is only connected intermitantly, I must be able to set some sort of timeout on SERIN. From the documentation I cannot see this option for the BS1. The BS2 however has it. I am thinking that this cannot be done with the BS1

Joe

Mike Green
09-07-2008, 04:40 AM
The BS1 doesn't have timeouts. If you have an extra I/O pin, you could implement DTR. This is an RS232 handshake line that's normally low (-3V to -15V) if the serial port is open. If you have a pullup on that line to +3v to +15V, it would be high (inactive) if there's no PC. The BS1 would only send the "?" if DTR were low.

joekamphaus
09-07-2008, 04:53 AM
Hmm. This sounds like a real possibility! We'll give it a try.

Thanks
Joe

joekamphaus
10-23-2008, 08:26 AM
I am still struggling with this. I guess I don't know what is meant by or how to make a "pull up" . I tried using a pnp transistor to no avail. I guess I don't know what I am doing as I am a programmer, not a electronics whiz. Could someone explain this?

Joe

NR1X
10-23-2008, 08:48 AM
pull up simply refers to connecting the stamps I/o pin to vdd.. normaly done via a resistor
it might be of benefit to you to check out the whats a microcontroller text.. this would give you enough electronics to do what you ask..
http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Wamv2_2.pdf

Post Edited (kb1nrb) : 10/23/2008 12:54:29 AM GMT