Does anybody know if it is possible to have a program communicate with the BS1USB? For instance when u hit a certain key it turns on an LED or something like that.
That would work as long as you use the circuit in the PBasic manual (see SERIN and SEROUT statements). The Stamps accept TTL logic levels (0V/5V) while a serial line has RS232 voltage levels (maybe +12V/-12V). Generally, the Stamps can transmit to a serial line and need a protective resistor (22K) when receiving from a serial line to one of the I/O pins.
with SERIN i can make it wait for a certain string, does that mean that u can send characters tthrough serial?(and the basic stamp will recieve it or will it only accept on or off)
SERIN will cause the Stamp to receive one or more serial characters. SEROUT will cause the Stamp to transmit serial characters. There are lots of other things you can do with an I/O pin. For example, you can "read" the value of a resistor using the POT statement for the BS1. You can debounce a pushbutton with the BUTTON statement.
just a quick question, if i powered the BS1USB with a 5v supply to the usb connector externally from the computer, will the microcontroller work on it's own? say if i wanted to load a program to it to have it operate externally from the pc?
If you’re asking if the BS1-USB will operate without the PC that programmed it, the answer is yes. Once you download the program to the BS1-USB it remains on it and runs whenever the unit is powered from 5V. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ Chris Savage Parallax Tech Support
If you look in the PBasic manual under "Basic Stamp Architecture - Memory Organization", you'll see a table showing the memory layout for the BS1 (Table 4.1). The names for the various words and bytes there are essentially pre-defined variables. You can use them directly in any statement as variables. In the example you posted, you'd put "DIRS = %11111111" and "PINS = %10101011".
There are no interrupts on the Stamps although there's a special polling mechanism on the BS2p/pe/px Stamps. Your program needs to have some kind of loop where a pin is checked every cycle through the loop and your program calls the subroutine when the check is positive.
On the BS1, there's no way to interrupt statements like SERIN or COUNT that execute for a prolonged period of time (other than by resetting the chip).
Comments
james
If you’re asking if the BS1-USB will operate without the PC that programmed it, the answer is yes. Once you download the program to the BS1-USB it remains on it and runs whenever the unit is powered from 5V. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
in the syntax guide it says the pins are bit addressable.
so instead of having to do
high 0
high 1
high 2
low 3
low 4
low 5
high 6
high 7
i could just use WRITE PINS, %11000111
not sure if this can be done, just wondering. thanks.
this is the code i tried.
' {$STAMP BS1}
' {$PBASIC 1.0}
MAIN:
SYMBOL e = PINS
SYMBOL d = DIRS
WRITE d, %11111111
WRITE e, %10101011
END
but didn't work.
On the BS1, there's no way to interrupt statements like SERIN or COUNT that execute for a prolonged period of time (other than by resetting the chip).