Basic Stamp OEM module By Wilmer Arellano. 2  The BASIC Stamp 2 OEM is a discreet component version of the BS2 which may be purchased in kit form. 

Slides:



Advertisements
Similar presentations
Amplifying Signals Breadboarding: from a diagram to an actual working amplifier.
Advertisements

10 Ways to Ruin Your Mini-Max microcontroller (and lose $69)
Microprocessor Motor Control Spring Introduction  Stamp projects Robots  Sensors  Motor control  Logic Rocketry  Reading acceleration (“g”
Introduction 2 BASIC Stamp®. Microcontrollers Microcontrollers can be thought of as very small computers which may be programmed to control systems such.
1 Chapter 2: Light on- Lights off Presentation based on: "What's a Microcontroller ?" By Andy Lindsay Parallax, Inc Presentation developed by: Martin A.
CSC 405 Lab 1 - Building a Simple Combinatorial Circuit In this laboratory exercise you will learn about the layout of some small-scale integrated circuits.
Boe-bots and STEM Boe-bots and STEM – This sectional will introduce participants to a programmable robot that is useful for engaging students in building.
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
Using the Board of Education Breadboard and Your Multimeter ENGR 120 Work in teams of two!
Parallax, Inc. Presentation based on: “Robotics: with the Boe-Bot"
1 Boe-Bot Parts BOE-BOT Lecture #1b DE - Digital Electronics.
Light Emitting Diode: LED. What is an LED?  Light-emitting diode  Semiconductor  Has polarity.
Basic Stamp II is kinda cool Bytes of EEPROM(non-volatile) - Clock speed of 20 MHz. - Holds 600 lines of code in EEPROM - executes an average of.
ENGR 101: Robotics Lecture 5 – Subprograms Outline  Subprograms  The Infrared Sensor System References 
DC Motors, Stepper Motors, H-bridges DC Motors Stepper Motors Motor Control Circuits – Relays – H-bridges.
Input and Output Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale
Embedded Programming and Robotics Lesson 1 Basic Electricity and Electronics Transistor Basics Lesson 1 -- Basic Electricity1.
Embedded Programming and Robotics
Slide Menlo Drive Suite 100 Rocklin, CA Presentation based on: “What’s a Microcontroller?" by Andy Lindsay Presented by Andy.
Basic Stamp Quick Start. Basic Stamp II Self contained computer –“Micro-controller” Specialized for “embedded” computing (sensing and controlling things)
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
BASIC Stamp Editor Once installed, the Stamp Editor will be available on your desktop, and as a menu option under Start  Program Files  Parallax Inc.
Ch4 Electronic Components Circuit/Schematic Symbols.
Objectives How Microcontroller works
1 Applied Control Systems Technology. 2 Pin configuration Applied Control Systems.
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Slide Menlo Drive Suite 100 Rocklin, CA Presentation based on: “What’s a Microcontroller?" by Andy Lindsay Presented by Jessica.
The Basic Stamp Instruction Set Architecture. The Microprocessor A microprocessor is a computer that typically has an architecture that is well suited.
Boe-Bot Review.
1 Basic Electronics Voltage (V or E): Potential difference between 2 points. Volts. (+) - A lack of electrons (-) – A surplus of electrons When a circuit.
MICRO CONTROLLER MODULE 1. Learning Objectives Name some gadgets that use microcontrollers. Define a microcontroller. Differentiate between a computer.
Basic Stamp OEM module By Wilmer Arellano. OEM BASIC Stamp 2sx Wiring diagram Note: - is connection to negative pole of the battery 220 Ohm Push button.
Controlling the Outside World
Programming the CheapBot-14. Start the Editor Set the Mode.
First, let’s review the structure and use of a breadboard.
Software and documentation Download and install: “Setup-Stamp-Editor-Lrg-v2.2.6.exe”  Downloads  BASIC Stamp software BASIC Stamp Syntax.
1 Parallax BASIC Stamp ® Tutorial Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale.
Digital Electronics Board-of-Education : Input. Board of Education - Input This presentation will explain, both from a hardware and software perspective,
ME456: Mechatronics Prof. Clark J. Radcliffe Mechanical Engineering
ME456: Mechatronics Systems Design Lecture 3 Chapter 2: Lights On –Lights Off Prof. Clark J. Radcliffe Mechanical Engineering Michigan State University.
CSC522 Embedded Systems Introduction to Circuit Design.
Slide Menlo Drive Suite 100 Rocklin, CA Presentation based on: “What’s a Microcontroller?" by Andy Lindsay Presented by Andy.
ENGR 101: Robotics Lecture 3 – Robot Motion Outline  Robot Motion  FOR Loops  Making Music References 
ENGR 101: Robotics Lecture 4 – Making Decisions Outline  The Stall Sensor  Making Decisions  Random Number Generation References 
July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook.
How an NPN Transistor Works
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Prepared by: Engr. Qurban Ali Memon 11ES (SEC- 1 & 2)
Slide Menlo Drive Suite 100 Rocklin, CA
ME456:Mechatronics WAM Chapter 1: Getting Started Prof. Clark J. Radcliffe Mechanical Engineering Michigan State University
PHY 235 Robotics Workshop Day 4 Robotic Behaviors, Light Sensing, Voltage Dividers, LCD-MOD.
Basic Stamp OEM module By Wilmer Arellano. 2  The BASIC Stamp 2 OEM is a discreet component version of the BS2 which may be purchased in kit form. 
Digital Electronics Board-of-Education : Output. Board of Education - Output This presentation will explain, both from a hardware and software perspective,
Basic Stamp OEM module By Wilmer Arellano. 2  The BASIC Stamp 2 OEM is a discreet component version of the BS2 which may be purchased in kit form. 
Basic Stamp OEM module By Wilmer Arellano. 2  The BASIC Stamp 2 OEM is a discreet component version of the BS2 which may be purchased in kit form. 
Controlling an LED with a switch. 2 breadboard place where you can build electric circuits really quickly the magical breadboard.
Slide Menlo Drive Suite 100 Rocklin, CA
OEM BASIC Stamp 2sx 220 Ohm.
Diagram of the Board of Education
Programming Boe-Bots (Part 1)
How to avoid catching things on fire.
Raspberry Pi: External Inputs & Outputs
Basic Electronics Part Two: Electronic Components.
Arduino Part 4 Let there be more light.
How an NPN Transistor Works
Fevzi Ozaydin & Violet Mwaffo
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Programming the BASIC Stamp
Intro to Arduino Part 2 The Breadboard
I/O Experiments Assignment 1.
Presentation transcript:

Basic Stamp OEM module By Wilmer Arellano

2  The BASIC Stamp 2 OEM is a discreet component version of the BS2 which may be purchased in kit form.  The male header provides the means to ‘plug-it’ into your own board, or connect to other boards. Regulated 5V (Vdd) Ground- 0V (Vss) 5.5 – 15V input (Vin) Reset Input (RES) P0-P15 I/O Power the board with EITHER: A) VDC on Vin. This will also provide 5VDC regulated output on Vdd. B) Regulated 5V Input on Vdd.

Using the breadboard (Socket board) The bread board has many strips of metal (copper usually) which run underneath the board. The metal strips are laid out as shown in orange. The long top and bottom row of holes are usually used for power supply connections. To use the bread board, the legs of components are placed in the holes (the sockets). The holes are made so that they will hold the component in place. The circuit is built by placing components and connecting them together with jumper wires.

Connection 220 Ohm resistor should be connected to pin P4 of the OEM Basic Stamp 2sx. “+” (long) lead of LED should be connected to opposite side of the resistor. The other (short) lead of the LED goes to “-” 220 Ohm LED 9 V battery

' {$STAMP BS2sx} ' {$PBASIC 2.5} Green: 'Label Or point were you can RETURN LOW 4 'Set pin 4 an output pin and low voltage "0" PAUSE 1000 'Pause 1000 ms HIGH 4 'Set pin 4 an output pin and high voltage "1" PAUSE 1000 'Pause 1000 ms GOTO Green Flashing LED

' {$STAMP BS2sx} ' {$PBASIC 2.5} Green: 'Label Or point were you can RETURN LOW 4 'Set pin 4 an output pin and low voltage "0" PAUSE 1000 'Pause 1000 ms HIGH 4 'Set pin 4 an output pin and high voltage "1" PAUSE 1000 'Pause 1000 ms DEBUG ? IN1 'Input the value of pin 1 PAUSE 1000 'Pause 1000 ms GOTO Green Flashing LED + Switch Input

' {$STAMP BS2} ' {$PBASIC 2.5} OUTPUT 4 Green: OUT4=0 PAUSE 1000 OUT4=1 PAUSE 1000 DEBUG ? IN1 PAUSE 1000 GOTO Green

' {$STAMP BS2} ' {$PBASIC 2.5} OUTPUT 4 INPUT 1 Green: OUT4=IN1 PAUSE 1000 GOTO Green

Variables Bit 0 or 1 Nibble (Nib) 0-15 Byte0-255 Word or to

' {$STAMP BS2} ' {$PBASIC 2.5} NS VAR Bit EW VAR Bit TOTAL VAR Byte NOC CON 20 TOTAL = 0 OUTPUT 4 INPUT 1 TOTAL = TOTAL +100 DEBUG ? TOTAL TOTAL= TOTAL/3 DEBUG ? TOTAL DEBUG ? NOC Green: OUT4=IN1 PAUSE 1000 GOTO Green

Pseudo Code Start of program Measure temperature  Temperature < 100 F? Yes, Turn on heat  Temperature > 102 F? Yes, Turn on cooling fan Go back to start.

13 Start Measure Temperature Temp. < 100 Energize Heater Temp. > 102 Energize Fan Star t Yes No Yes No

14 Sequential Flow Example Pseudo-Code: Start of program  Turn off LED 1  Turn off LED 2  Pause for 2 seconds  Light LED 1  Pause for 2 seconds  Light LED 2  End of program Flowchart: ' <<<< INSERT COMMON ' CIRCUIT DECLARATIONS >>>>CIRCUIT DECLARATIONS 'Prog 6A: Example of sequential flow ' ****** Main program ************ LED1 = LED_Off'Turn off LED 1 LED2 = LED_Off'Turn off LED 2 PAUSE 2000'Pause for 2 sec. LED1 = LED_On'Light LED 1 PAUSE 2000'Pause for 2 sec. LED2 = LED_On'Light LED 2 ENDCode: Start Turn OFF LED1 Turn OFF LED2 2 Second Pause Turn ON LED1 Turn ON LED2 2 Second Pause End

Branching Overview - GOTO Branching is the act of breaking out of a sequence to perform code in another location of the program. The simplest form of branching is to use the GOTO instruction: GOTO label

16 Looping Flow Example Pseudo-Code: Start of program  Turn off LED 1  Turn off LED 2  Pause for 2 seconds  Light LED 1  Pause for 2 seconds  Light LED 2  Go back to start ' <<<< INSERT COMMON ' CIRCUIT DECLARATIONS >>>>CIRCUIT DECLARATIONS 'Prog 6B: Example of sequential flow ' with looping ' ****** Main program ************ Main: LED1 = LED_Off'Turn off LED 1 LED2 = LED_Off'Turn off LED 2 PAUSE 2000'Pause for 2 sec. LED1 = LED_On'Light LED 1 PAUSE 2000'Pause for 2 sec. LED2 = LED_On'Light LED 2 GOTO Main'Repeat sequenceCode:Flowchart: Start Turn OFF LED1 Turn OFF LED2 2 Second Pause Turn ON LED1 Turn ON LED2 2 Second Pause

Conditionals Overview The previous example is an unconditional branch; the program will branch back to Main regardless of any code parameters. In a conditional branch a decision is made based on a current condition to branch or not to branch. As humans, we constantly make decisions based on input as to what to perform. Shower too cold? Turn up the hot. Shower too hot? Turn down the hot water. Microcontrollers can be programmed to act based on

IF…THEN The IF-THEN is the primary means of conditional branching. IF condition THEN addressLabel If the condition is evaluated to be true, execution will branch to the named address label. If the condition is not true, execution will continue to the next step in the program sequence. A condition is typically an equality: value1 = value2 value1 > value2 value1 < value2 IN8 = 1 Compared to many versions of BASIC and other languages, the PBASIC 2.0 implementation of the IF-THEN is fairly limited. See the PBASIC 2.5 appendix for new implementations of IF-THEN.

19 IF-THEN Example: Alarm  This program will sound the alarm as long as pushbutton 1 is pressed. Start: Is button 1 pressed?Is button 1 pressed? Yes, Go sound AlarmYes, Go sound Alarm No, Go back to startNo, Go back to startAlarm Sound speakerSound speaker Go back to start of programGo back to start of program ' <<<< INSERT SECTION 5 COMMON ' CIRCUIT DECLARATIONS >>>> CIRCUIT DECLARATIONS 'Prog 6C: Conditional Branching Alarm Main: ' If pushbutton 1 is pressed, ' then go sound alarm IF PB1 = PB_On THEN Alarm GOTO Main Alarm: 'Sound the alarm FREQOUT Speaker, 1000, 2000 GOTO Main Pseudo-Code Flowchart Program Code Button 1 Pressed Main Speaker 2000Hz for 1 second Main TrueFalse

' {$STAMP BS2} ' {$PBASIC 2.5} NS VAR Bit EW VAR Bit OUTPUT 4 OUTPUT 10 INPUT 1 Green: OUT4=1 OUT10=0 NS=IN1 IF NS=1 THEN green OUT4=0 OUT10=1 PAUSE GOTO Green

Car1 ' {$STAMP BS2sx} ' {$PBASIC 2.5} PAUSE 5000 HIGH 10 LOW 11 start: HIGH 4 HIGH 8 LOW 9 PAUSE 3000 LOW 4 LOW 8 PAUSE 3000 HIGH 9 PAUSE 3000 LOW 9 PAUSE 3000 GOTO start

PWM

Car 2 ' {$STAMP BS2sx} ' {$PBASIC 2.5} PWM 8, 200, 255

Car 3 ' {$STAMP BS2sx} ' {$PBASIC 2.5} DO PWM 8, 80, 255 LOOP

Car 4 ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 1 DO WHILE (IN1 = 0) PWM 8, 80, 255 LOOP

Car 5, Switch in pin 1 will stop ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 1 DO WHILE (IN1 = 0) PWM 8, 80, 255 LOOP

Car 6, Switch in pin 1 will change speed ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 1 DO IF IN1 = 0 THEN PWM 8, 80, 255 ELSE PWM 8, 255, 255 ENDIF LOOP

IR SENSOR ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 6 DO FREQOUT 5, 10, IF IN6 = 0 THEN HIGH 4 ELSE LOW 4 ENDIF LOOP LED at pin 4 will turn on if an object is present

Car 7 ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 6 PWM 8, 120, 255 DO FREQOUT 5, 10, IF IN6 = 0 THEN LOW 8 ELSE PWM 8, 120, 255 ENDIF LOOP IR emitter pin 5 Sensor pin 6 There is no need for the pause The car will stop completely

Car 8 ' {$STAMP BS2sx} ' {$PBASIC 2.5} INPUT 6 PWM 8, 150, 255 LOW 11 DO FREQOUT 5, 10, IF IN6 = 0 THEN HIGH 9 HIGH 11 PAUSE 1000 ELSE LOW 11 LOW 9 PWM 8, 150, 255 ENDIF LOOP If obstacle detected, the car will move backwards while turning Try to use left and right sensors You are not required to use the PING sensor this time. If you are interested please let me know