July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Advertisements

Microprocessors Typical microprocessor controlled devices: Camera, mobile phone, stereo, mp3 player, electronic toys… High-level microprocessor controlled.
Lab7: Introduction to Arduino
Introduction 2 BASIC Stamp®. Microcontrollers Microcontrollers can be thought of as very small computers which may be programmed to control systems such.
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
Using the Board of Education Breadboard and Your Multimeter ENGR 120 Work in teams of two!
1 Boe-Bot Parts BOE-BOT Lecture #1b DE - Digital Electronics.
Hardware Meets Software CPSC 120 Principles of Computer Science February 15, 2012.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
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.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
University of Pennsylvania 1 The BASIC Stamp 2. University of Pennsylvania 2 The BASIC Stamp 2 Serial Signal Conditioning Conditions voltage signals between.
ENGR 101: Robotics Lecture 2 – Text Programming Outline  Introduction to PBASIC  Variables, I/O, Arithmetic  Controlling the LEDs References 
Recap – Our First Computer WR System Bus 8 ALU Carry output A B S C OUT F 8 8 To registers’ input/output and clock inputs Sequence of control signal combinations.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Input and Output Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Embedded Programming and Robotics
LSU 06/04/2007BASIC Stamp Editor1 The BASIC Stamp Editor Programming Unit, Lecture 3.
Basic Stamp Quick Start. Basic Stamp II Self contained computer –“Micro-controller” Specialized for “embedded” computing (sensing and controlling things)
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.
MICROCONTROLLERS MODULE 2 Programming, Controlling and Monitoring.
Parallax BASIC Stamp® Tutorial
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.
Designing A Computer CPSC 120 Principles of Computer Science February 6, 2012.
Lesson 3 — How a Computer Processes Data
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.
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.
Programming the CheapBot-14. Start the Editor Set the Mode.
Chapter 5: Computer Systems Organization Invitation to Computer Science, Java Version, Third Edition.
10/10/ Controlling YOUR ROBOT. 10/10/2015 Basic Stamp  Basic Stamp Input - output pins Interpreter Chip Power supply: 5 Volts voltage Memory: EEPROM.
Advanced Digital Circuits ECET 146 Week 4 Professor Iskandar Hack ET 221G,
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. 
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
ME456: Mechatronics Prof. Clark J. Radcliffe Mechanical Engineering
Microcontrollers Module 3: Digital Display. 7 – Segment Display A seven-segment display (SSD), or seven- segment indicator, is a form of electronic display.
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. 
Digital Electronics Board-of-Education : Output. Board of Education - Output This presentation will explain, both from a hardware and software perspective,
PLC ARCHITECTURE – Memory 2 by Dr. Amin Danial Asham.
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. 
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
IC 3 BASICS, Internet and Computing Core Certification Computing Fundamentals Lesson 2 How Does a Computer Process Data?
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Arduino Part 1 Topics: Microcontrollers
PICAXE Microcontroller
Lab 1: Using NIOS II processor for code execution on FPGA
Fundamentals of Computer Engineering
Introduction to the Arduino
Learning to Program D is for Digital.
An Arduino Workshop A Microcontroller.
Chapter 1: Getting Started
Introduction to Microcontrollers and the Board of Education
BASIC Stamp II Programming for Descartes Robots
Arduino Part 1 Topics: Microcontrollers Programming Basics
Programming Boe-Bots (Part 1)
Describe how NASA remotely controls equipment in space.
Controlling YOUR ROBOT
CSCI1600: Embedded and Real Time Software
Chapter 5: Computer Systems Organization
PICAXE BASIC The programming language used by the PICAXE microcontrollers is called BASIC. BASIC is a very early programming language and designed to make.
CSCI1600: Embedded and Real Time Software
Aeroponic Engineering and Vertical Farming
Lab #1: Getting Started.
Introduction to Arduino IDE and Software
Programming Logic and Design Eighth Edition
Presentation transcript:

July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook Jun Rajan Bhatt Dr. Venkat Krovi

July 7, 2003 Slide 2 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Basic Stamp II Self contained computer –“Micro-controller” Specialized for “embedded” computing (sensing and controlling things) –Built in programming language PicBasic (interpreted) Small programming environment runs on a PC –Connected with a serial cable

July 7, 2003 Slide 3 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Parallax Basic Stamp II PIC processor –(Very) roughly the computing power on the lunar module (much faster, but much less memory) –1 million instructions / sec Non-volatile memory Power regulation Serial interface { }

July 7, 2003 Slide 4 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Parallax Basic Stamp II Input/output pins –16 total (P0…P15) –This is where the action is –Each pin can be accept input or produce output Logic levels (0 or +5v) Also “tricks” for sensing and producing values in between

July 7, 2003 Slide 5 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Identifying the BASIC Stamp Connect the BASIC Stamp carrier board to your computer with a serial cable. Power-up your BASIC Stamp carrier board. Use the Identify button to verify communications to your BASIC Stamp.

July 7, 2003 Slide 6 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Writing the Program BASIC Stamp programs are written in a version of BASIC called PBASIC entered into the BASIC Stamp Editor. A program typically reads inputs, processing data, and controls outputs. Programs must conform to the rules of syntax so that the BASIC Stamp can understand what you are telling it. DEBUG “Hello World”

July 7, 2003 Slide 7 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Variables Overview Variables are needed when a program requires a value to be stored. Variables correspond to a memory location which we can read from and write to (Random Access Memory – RAM). Variables allow the programmer to use descriptive words to indicate the contents of the memory location.

July 7, 2003 Slide 8 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Constants Constants provide the ability to assign names to values that do not change. They allow an easier reading of code. Common uses of constants: –Naming of I/O pin numbers. –Naming of values which will not change such as PI (Note: the BS2 operates on whole numbers only). Constant names follow the same rules as variables and are declared as follows: constant Name CON value

July 7, 2003 Slide 9 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Stamp I/O There are 16 I/O (Input/Output) pins on the BS2 labeled P0 to P15. These are the pins through which input and output devices may be connected. Depending on the code that is written, each pin may act as an input to read a device, or as an output to control a device. We will begin by using a very common and simple output device, the LED.

July 7, 2003 Slide 10 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Output - Connecting an LED In this configuration a LOW, or 0V, at P0 will allow current to flow through the LED to Vdd (+5V) lighting it. When P0 is HIGH (+5V), no current will flow and the LED will not light. The LED is Active Low.

July 7, 2003 Slide 11 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Use the Stamp Editor to enter the following program: Download or run the program. Monitor the LED. It should blink at a rate of 1 second OFF, 5 seconds ON. If not, check your configuration and code. ‘Prog : Blink LED program Main: HIGH 0'Turn off LED PAUSE 1000'Wait 1 second LOW 0'Turn on LED PAUSE 5000'Wait 5 seconds GOTO Main'Jump back to beginning Blinking the LED with HIGH, LOW

July 7, 2003 Slide 12 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Code Discussion HIGH defines the pin to be an output and sets it to a HIGH state, digital 1 or 5V. –HIGH pin 0-15 –HIGH 8 LOW defines the pin to be an output and sets it to a LOW state, digital 0 or 0V. –LOW pin 0-15 –LOW 8 PAUSE instructs the BS2 to wait for the defined number of milliseconds (1/1000 seconds). –PAUSE time in milliseconds –PAUSE 1000 GOTO instructs the BS2 to jump to the defined label. More about this will be covered in Programming Structures. –GOTO Label

July 7, 2003 Slide 13 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Challenge : Blink a 2 nd LED  Connect a second active-low LED2 on P1.  Code a program to blink only this LED using HIGH and LOW instructions.

July 7, 2003 Slide 14 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Challenge : LED Cycling Code a program to perform the following sequence (use HIGH and LOW): –LED1 on P0 ON, LED2 on P1 OFF –Wait 2 seconds –LED1 on P0 ON, LED2 on P1 ON –Wait 1 second –Both LEDs OFF –Wait one-half second –Repeat

July 7, 2003 Slide 15 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Sound output FREQOUT Pin, Len, Freq1 FREQOUT Pin, Len, Freq1, Freq2 Len in ms Freq in Hz –0 for off

July 7, 2003 Slide 16 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Debugging Debugging refers to the act of finding errors in code and correcting them. There are 2 types of errors which can be made when coding: Syntax errors and Logical errors. –Syntax errors are those that occur when the editor/compiler does not understand the code written. An example would be: GO TO Main The PBASIC tokenizer, which takes our code and puts it in a form the BS2 understands, does not have an instruction called GO TO (it has one called GOTO). This section of code would be flagged as having a syntax problem, which we identify and correct.

July 7, 2003 Slide 17 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction to Flow The programs in the tutorial have been relatively easy and follow a sequence of steps from top to bottom. At the end of each program, GOTO Main has been used to loop the program back to the start. Virtually all microcontroller programs will continually repeat since they are typically embedded in processes to be operated continually. Sequential flow (top to bottom), looping, unconditional branching, and conditional branching will be explored in this section.