ME456:Mechatronics
WAM Chapter 1:Getting Started
Prof. Clark J. Radcliffe
Mechanical Engineering
Michigan State University
http://www.egr.msu.edu/classes/me456/radcliff
BASIC Stamp II
• An integrated microcontroller system• Postage Stamp Size, Programmed in BASIC
2k byteEEPROM
5 voltRegulator
InterpreterChip
PIC16C57w/ 26 bytes RAM
20 MHzResonator
SerialInterface
I/O Pins0-7
I/O Pins8-15
The Basic Stamp
• Introduced them in 1992. • As of July 2000, > 200,000 BASIC Stamp
modules into use. • Each BASIC Stamp includes:
– a BASIC Interpreter chip– internal memory (RAM and EEPROM)– a 5-volt regulator– 16 general-purpose I/O pins (TTL-level, 0-5 volts)– built-in commands for math and I/O pin operations.– 5 models: BS1, BS2, BS2e, BS2sx & BS2p.
BASIC Stamp I
• The original Basic Stamp• 8 i/o pins• 16 bytes of RAM• 256 bytes of program storage• Fewer programming functions• 2000 PBASIC statements/sec • 2 ma running power requirement• Parallel port interface
BASIC Stamp II
• Specifications– 4000 BASIC Statements per second– 16 Digital I/O pins
• Source 20 mA, Sink 25 mA
– Special purpose control routines– 5v power supply (50 mA)– Low power (8 mA, sleep at 0.1mA)– RS232 serial programming interface– 2k bytes program token storage
Basic Stamp 2 IC
Other BS2
• BS2e: – 64 bytes scratch pad RAM– 30 mA i/o pin current
• BS2sx:– 39 PBASIC Commands – 10,000 instructions/sec
• BS2p24: – 12,000 instructions/sec– 55 PBASIC Commands
• BSp40, BS2pe - more features
Board of Education
Allows easy prototyping with BSII5 volt 1.5ARegulator
9 volt BatteryConnector
USB / SerialInterface
To PC
BASICStamp II
Microcontroller
CircuitPrototyping
Area
DigitalI/O
Connector
5v PowerSupply
Connection
WallTransformerConnection
ResetButton
On-Off Switch
RC Servo Connections
BS2 RAM OrganizationWord Name Byte Name Nibble Name Bit Name Note
INS INLINH
INA, INBINC, IND
IN0-IN7,IN8-IN15
Input pins
OUTS OUTL,
OUTH
OUTA, OUTB,OUTC, OUTD
OUT0 – OUT7OUT8 – OUT15
Output pins
DIRS DIRL,
DIRH
DIRA, DIRB,DIRC, DIRD
DIR0 – DIR7DIR8 – DIR15
Direction bits0 = input1=output
W0 B0B1
N0N1
Bit names are not typically used (See Memory and Variables Help)
General Purposeword, byte, nibble and bit addressable
.
.
.
.
.
.
.
.
.W12 B24
B25N48N49
PBASIC Examples
'{$STAMP BS2}'{$PBASIC 2.5}
‘Define symbolsLED CON 14 'LED control pinTime CON 15 'Pause time (ms)
‘Flash LED’s (pins connected “low”)DO ‘loop forever HIGH LED ‘Turn LED off PAUSE Time LOW LED ‘Turn LED on PAUSE TimeLOOP
Some Examples
Let’s run the Basic Stamp Editor …