Programming the BASIC Stamp

Slides:



Advertisements
Similar presentations
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC)  Read.  Homework #13 and Lab #13 due next week. 
Advertisements

Microprocessor Motor Control Spring Introduction  Stamp projects Robots  Sensors  Motor control  Logic Rocketry  Reading acceleration (“g”
Indian Institute of Technology Hyderabad ROBOTICS LINE FOLLOWER HARI KISHAN TANDEY – ES12B1008 DILIP KONDAPARTHI – ES12B1010 SAI KARTIK – CE12B1015.
Hardware Meets Software CPSC 120 Principles of Computer Science February 15, 2012.
Digital Tachometer ENGR 4803 Electromechanical Systems & Mechatronics.
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 2 – Text Programming Outline  Introduction to PBASIC  Variables, I/O, Arithmetic  Controlling the LEDs References 
Laboratory 5: Introduction to LabVIEW. Overview Objectives Background Materials Procedure Report / Presentation Closing.
Microcontrollers Instructor:Shuvra Das mechanical engineering department University of Detroit Mercy.
Digital I/O Connecting to the Outside World
Introduction.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Fischertechnik ® Interface Connections. The Serial Interface Connects the Computer with the fischertechnik ® model
Basic Stamp Quick Start. Basic Stamp II Self contained computer –“Micro-controller” Specialized for “embedded” computing (sensing and controlling things)
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
PIC microcontrollers. PIC microcontrollers come in a wide range of packages from small chips with only 8 pins and 512 words of memory all the way up to.
Programmable Systems  Electronic devices have been developed to make life more enjoyable, easier, safer or more productive.  Some examples: Microwave.
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.
1 Applied Control Systems Technology. 2 Pin configuration Applied Control Systems.
Computer Sensing and Control How is binary related to what we are trying to accomplish in electronics? The PC GadgetMaster II uses binary to communicate.
Last week’s project demos Servo control with potentiometer and enable/disable buttons Demo in class tonight – don’t start on the next project until I’ve.
The Basic Stamp Instruction Set Architecture. The Microprocessor A microprocessor is a computer that typically has an architecture that is well suited.
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.
Introduction to the Arduino
Programming the CheapBot-14. Start the Editor Set the Mode.
10/10/ Controlling YOUR ROBOT. 10/10/2015 Basic Stamp  Basic Stamp Input - output pins Interpreter Chip Power supply: 5 Volts voltage Memory: EEPROM.
Software and documentation Download and install: “Setup-Stamp-Editor-Lrg-v2.2.6.exe”  Downloads  BASIC Stamp software BASIC Stamp Syntax.
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. 
Microcontroller I Seth Price Department of Chemical Engineering New Mexico Tech Rev. 9/22/14.
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.
Digital Electronics Introduction to Microcontrollers and the Board of Education.
ME456:Mechatronics WAM Chapter 1: Getting Started Prof. Clark J. Radcliffe Mechanical Engineering Michigan State University
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. 
July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon.
Digital Electronics Board-of-Education : Output. Board of Education - Output This presentation will explain, both from a hardware and software perspective,
Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output.
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. 
Introduction to LabVIEW
1 BOE-BOT Lecture #2 DE - Digital Electronics Servos and the BOE-BOT.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Lesson 1 PLC BASICS. PLC Definition  Programmable Logic Controllers are industrial computers that control machine and other applications.  PLC have.
Having fun with code, using Arduino in a middle school CS classroom
Computer Architecture and Number Systems
Arduino Part 1 Topics: Microcontrollers
Microcontrollers, Basics Tips and Tricks with PIC MCUs
Microprocessors Tutorial 1: Arduino Basics
Arduino & its hardware interfacing
Microcontroller Applications
Introduction to Handshaking Communication with SSC-32U
Chapter 1: Getting Started
Introduction to Microcontrollers and the Board of Education
BASIC Stamp II Programming for Descartes Robots
Programming Boe-Bots (Part 1)
Introduction to Arduinos
Describe how NASA remotely controls equipment in space.
Lesson 2: Introduction to Control programming using Labview
Variables In programming, we often need to have places to store data. These receptacles are called variables. They are called that because they can change.
McGraw-Hill Technology Education
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Controlling YOUR ROBOT
EET 2261 Unit 14 INCOMPLETE Analog-to-Digital Conversion (ADC) & Digital-to-Analog Conversion (DAC) Read. Homework #13 and Lab #13 due next week. Quiz.
Arduino 7 Segment Display Lab
McGraw-Hill Technology Education
McGraw-Hill Technology Education
Introduction to Arduinos
Interface ckt for demo Outputs Inputs V PIN 0 10K PIN 4 GND GND
Presentation transcript:

Programming the BASIC Stamp Computers do exactly what you tell them, no more, no less BASIC Stamp uses the PBASIC programming language You can go a long ways with just a few instructions See the BASIC Stamp Guide (2011 web site) - Programs are the list of instructions (recipe) for telling the computer what to do. - Programming language defines a particular vocabulary set and syntax. You must follow without deviations. Mistakes often hard to find. - PBASIC is (a little) like BASIC, but greatly simplified, and tailored to running I/O ports on the Stamp chip. - Pentium III runing Visual Basic: $600 - Microchip running Stamp Basic: $1

On the Stamp Programming cable Power pins EEPROM Brain I/O pins Breadboard area 9V battery Reset

Schematic icons 1K TIP120

Dealing with the outside world SENSOR COMPUTER ACTUATOR Switch Light beam Potentiometer Encoder Temperature … Lamp Relay Motor Solenoid …

Driving actuators High 4 Program sets ports high/low (1/0) Low 4 +5V Stamp board pins set to +5V/0V TIP120 1K PIN 4 +12 V Interface electronics use signal voltages and power supply to switch motors on/off

Reading sensors Program reads value of ports (1/0) IF in4 = 1 THEN …. Stamp board pins set to +5V/0V 10K PIN 4 +5 V Interface electronics change sensor signals into +5V/0V

Format Labels, comments loop: toggle 0 ‘ toggle motor pause 250 ‘ pause for 250 goto loop Labels - colon to define, no colon to use - letters, numbers, _ start with letter Symbol Definition - text substitution - can make it simpler to read - don’t used reserved words - define at the top - use capitals (convention) - symbols are not variables Comments - ‘ or REM Misc: - case insensitive. Symbols LED con 1 MOTOR con 0 start: toggle LED toggle MOTOR pause 250 goto start

Data sizes A bit is one binary digit: 0/1 A byte is 8 bits b0 b7 00000011 (binary) = 3 (decimal) 11111111 = 255 Generic, for any computer Most modern programming languages deal in 32-bit words (4 billion or 4 Gigs) - Stamp is positive integers only - byte: 0-255 - word: 0-65,535 Type #bits Number range bit 1 0-1 byte 8 0-255 word 16 0-65,535

Variables Pins 15 i/o pins 0-15 for outputs in0-in15 for inputs Data variables 26 bytes of variable space byte (0-255)or word(0-65,535) Allocate like this: length var byte width var byte area var word Then in program: length = 20 width = 20 area = length * width Positive numbers only!! For HIGH, LOW, TOGGLE, use 0-7 rather than Pin0-Pin7

Math +,- add, subtract * multiply / division (truncates) x var byte x = x+2 result? Positive integers only Will overflow at 255 (demo with debug dec x) watch multiply overflow If x defined as a byte x = 50*50 = 2500 error (will return 196) division truncates y = 5/2 will return 2 Can use variables and constants x var byte x = 254 x = x+2 result? y var word y = 50*50 = 2500 x var byte x = 5/2

A FIRST PROGRAM ‘Turns on LED for a brief time LED con 0 high LED pause 200 low LED end Logical conditionals: = <> > < >= Most common use is to check state of a switch

LOOP LED con 0 doit: toggle LED pause 200 goto doit Logical conditionals: = <> > < >= Most common use is to check state of a switch

FOR…NEXT LOOP LED con 0 i var byte for i = 1 to 20 toggle LED pause 200 next end Logical conditionals: = <> > < >= Most common use is to check state of a switch

IF....THEN x var byte y var byte x = 5 y = 7 start: if x < y then motor high 1 ‘ led on goto continue motor: high 0 ‘ motor on continue: Conditionals: = <> > < >= <= Logical conditionals: = <> > < >= Most common use is to check state of a switch

IF....THEN, CHECKING AN INPUT motor con 1 start: if in4 = 1 THEN start gomotor: high motor ‘ motor on pause 2000 low motor end Logical conditionals: = <> > < >= Most common use is to check state of a switch