BS2P24 and LISP?
Brianmcm
Posts: 33
I'm looking into a project based around a Open Source AI robot as outlined in Leafproject.org, called "Leaf". Briefly the "Leaf" project is a laptop mounted to a mobile platform running an open source "Lisp" program to allow the bot to interact with its environment. The·BS2P24 would be the motor control, servo control, and for IR sensors. The challenge is to get the "Lisp" program to talk to the BS2P24. The Lisp also is talking to routines that provide image recognition via OpenCV and·speech via Microsoft Speech SDK5.1. Is there any document, i.e books etc, that could provide information in achieving this? My·initial thought would be using the SERIN command to address different subroutines of the program running on the BS2P24.
The other question I have is connecting the BS2P24 to the laptop via USB. I know downloading programs to the Stamp through the USB connection, but what about commanding the Stamp as I explained above; any guidance on that?
Please, excuse the wordy question here. Supprisingly I'm not the only one interested in this application as I posted a similar question on the "Leaf" Yahoo forum and was amazed at the number of people had the same thought as I did.
Thanks for your help.
·
The other question I have is connecting the BS2P24 to the laptop via USB. I know downloading programs to the Stamp through the USB connection, but what about commanding the Stamp as I explained above; any guidance on that?
Please, excuse the wordy question here. Supprisingly I'm not the only one interested in this application as I posted a similar question on the "Leaf" Yahoo forum and was amazed at the number of people had the same thought as I did.
Thanks for your help.
·
Comments
Any program on a PC can talk to a Stamp by using serial I/O. The PBasic manual describes how to hook a Stamp to a standard serial (RS232) port. The same thing applies to any USB to serial adapter. There are some problems with many USB to serial adapters when used for programming a Stamp (the DTR line doesn't work right), but, for program controlled communications, it shouldn't be an issue and pretty much any USB to serial adapter will work. You can use the programming port ("pin 16") with the DEBUG/DEBUGIN or SERIN/SEROUT statements, but there are some restrictions. That port only works at 9600 Baud, everything sent from the PC is echoed back to the PC, and, when the port is opened, the Stamp will be reset unless the DTR pin is temporarily disconnected. These are all artifacts of how the port is used for programming/debuggin with the Stamp Editor.
If you attach a serial port (or USB to serial adapter) to any other I/O pins, you need at least some resistors as described in the PBasic manual sections on the SERIN/SEROUT statements. It's very clear.
Once these are connected, it's up to the programmer to decide how to communicate and what messages to send back and forth. The Stamp has a variety of "formatters" as part of the SERIN/SEROUT statements that will take care of converting strings of digits to binary numbers and conversely and handling simple punctuation. The crucial parts are: 1) The Stamp's serial input processing is not buffered. The Stamp has to be waiting for the data to be transmitted. There are provisions for a timeout so the Stamp can wait, give up, do something else, and try again, but it will miss something that is sent while it's busy doing something else. There are 3rd party serial input buffer chips that can be installed between the serial input source and the Stamp to hold characters until the Stamp is ready to see them. 2) The Stamp is not very fast and tends to get overwhelmed when lots of serial data is received at modest speeds (9600 Baud). There are provisions for handshaking (CTS/RTS) in the SERIN/SEROUT statements. Use them if this is a problem or go to a slower Baud (2400 Baud).