Microcontrollers, Microcomputers, and Microprocessors

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Electrical team Arduino tutorial I BY: JOSHUA arduini
Lab7: Introduction to Arduino
Mini-SumoBot Construction and Programming
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
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
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.
chipKit Sense Switch & Control LED
Programming Hexors on Arduino Uno. Arduino Uno Arduino is an open-source electronics platform based on easy- to-use hardware and software. It's intended.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Intro to Arduino Programming. Draw your circuits before you build them From Arduino 330 Ohm From Arduino 330 Ohm From Arduino 330 Ohm.
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Introduction 2 Smart Design. What is smart design? 2 Everything is designed except nature The packaging of a Band-Aid The curve of a bike frame The shape.
Code The Arduino Environment.
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. ARDUINO BASICS Credit to: Sparkfun and Linz Craig, Nick Poole, Prashanta Aryal, Theo Simpson, Tai Johnson,
Arduino libraries Datatekniker Udvidet hardware/software.
Microcontroller basics Embedded systems for mortals.
Week 5: Microcontrollers & Flow Control Bryan Burlingame 2 March 2016.
Embedded systems and sensors 1 Part 2 Interaction technology Lennart Herlaar.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
:Blink Blink: Er. Sahil Khanna
Introduction to Programming the Arduino Dr Gaw 3/21/14.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
Arduino Part 1 Topics: Microcontrollers
INTRODUCTION TO ROBOTICS Part 5: Programming
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Dr. Kyung Eun Park Summer 2017
Val Manes Department of Math & Computer Science
Microcontroller basics
Arduino & its hardware interfacing
An Arduino Workshop A Microcontroller.
Get Your Project Started with Arduino
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
Arduino.
Introduction to Arduino Microcontrollers
Microcontrollers, Microcomputers, and Microprocessors
Week 5: Microcontrollers
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
FeMaidens Programming
Arduino 101 Credit(s):
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Introducing the Arduino Uno
Arduino Board.
Aeroponic Engineering and Vertical Farming
Introduction to Arduino
Lab #1: Getting Started.
Arduino Uno circuit basics
Setting up a basic program with Arduino
Introduction to Arduino IDE and Software
Presentation transcript:

Microcontrollers, Microcomputers, and Microprocessors General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter Microcontrollers, Microcomputers, and Microprocessors Digital Electronics © 2014 Project Lead The Way, Inc. Project Lead The Way, Inc. Copyright 2009

ATmega328 Microcontroller Processor Memory General Safety Microcontroller, Microcomputer, or Microprocessor? What is the difference? Digital Electronics TM 1.1 Foundations and The Board Game Counter A microcontroller is a small, low cost computer on a single integrated circuit. ATmega328 Microcontroller Processor Memory Programmable Input/Output(I/O) Arduino Uno Microcontroller Board SparkFun Electronics, . Arduino Uno - R3. 2013. Photograph. Wikipedia Commons Web. 7 Jan 2014. Microcontrollers are used to perform one dedicated task. One specific program. They are usually embedded in products. Project Lead The Way, Inc. Copyright 2009

input/output (I/O) facilities General Safety Microcontroller, Microcomputer, or Microprocessor? What is the difference? Digital Electronics TM 1.1 Foundations and The Board Game Counter A microcomputer is a small, relatively inexpensive computer with a microprocessor as its central processing unit. It includes: a microprocessor memory input/output (I/O) facilities Commodore 64 Microcomputer Evan-Amos, . Commodore-64-Computer. 2011. Photograph. Wikipedia Commons Web. 7 Jan 2014. <http://en.wikipedia.org/wiki/File:Commodore-64-Computer.jpg>.. Project Lead The Way, Inc. Copyright 2009

Why is it called a “micro” computer? General Safety Microcontroller, Microcomputer, or Microprocessor? What is the difference? Digital Electronics TM 1.1 Foundations and The Board Game Counter Why is it called a “micro” computer? Early computers such as ENIAC filled entire rooms. A “micro”computer by comparison with a keyboard, monitor, and mouse are commonly referred to as a personal computer today. The prefix “micro” is not commonly used in describing computers anymore. U.S. Army Photo, . ENIAC. 197. Photograph. Wikipedia Commons Web. 7 Jan 2014. Project Lead The Way, Inc. Copyright 2009

Microcontroller, Computer, or Processor? What is the difference? General Safety Microcontroller, Computer, or Processor? What is the difference? Digital Electronics TM 1.1 Foundations and The Board Game Counter Application Processors As the use of smart phones and mobile devices has expanded, a new type of processor has been defined. Intel® Quark SoC X1000 Application Processor Today, microprocessors in computers are often just referred to as processors. All computers today have a processor as the CPU. Microprocessors designed for use in mobile applications are called application processors. Project Lead The Way, Inc. Copyright 2009

Microprocessors don’t have RAM, ROM, and other peripheral on the chip. General Safety Microcontroller, Microcomputer, or Microprocessor? What is the difference? Digital Electronics TM 1.1 Foundations and The Board Game Counter A microprocessor is an IC which has only the Central Processing Unit inside them. They only have processing powers. Microprocessors don’t have RAM, ROM, and other peripheral on the chip. A system designer has to add them externally to make them functional.  Once again, the prefix “micro” is increasingly left today in favor of just processor. Project Lead The Way, Inc. Copyright 2009

What is a Microcontroller? General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter Microcontrollers are used to control many everyday products like garage door openers, traffic lights, home thermostats, and robots. Embedded controllers are everywhere. Project Lead The Way, Inc. Copyright 2009

What are the Parts of a Microcontroller? General Safety What are the Parts of a Microcontroller? Digital Electronics TM 1.1 Foundations and The Board Game Counter Microcontrollers contain: A Central Processing Unit (CPU) Some form of memory (MEMORY) Programmable Input / Output (I/O) ATmega328 Microcontroller Project Lead The Way, Inc. Copyright 2009

What are the Parts of the Arduino Microcontroller Board? General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter The Arduino Microcontroller Board Specifications: (14) Digital I/O Pins: (6) are PWM Specific (6) Analog I/O Pins Power: USB or external. If using power supply with 2.1mm center-positive plug, recommend range 7V-12V. USB Connection: Type B 5V or 3.3V option Digital / PWM Analog USB Power Vext Project Lead The Way, Inc. Copyright 2009

Programming a Microcontroller General Safety Programming a Microcontroller Digital Electronics TM 1.1 Foundations and The Board Game Counter Programming languages have their own grammar called syntax. Programs written with the Ardiuno software are called Sketches. A Sketch (program written with Arduino) will contain: Variables Functions Setup() Loop() Structures Comments Project Lead The Way, Inc. Copyright 2009

Programming a Microcontroller General Safety Programming a Microcontroller Digital Electronics TM 1.1 Foundations and The Board Game Counter The Arduino software consists of an Integrated development environment (IDE) and the core libraries. The core libraries are written in C and C++ and compiled using avr-gcc and AVR Libc. The Arduino software language you program in is very similar to C++ because it is derived from C/C++. These connections to C and C++, two languages that professional programmers are usually familiar with, make it a good platform for programmers who want to start tinkering. Project Lead The Way, Inc. Copyright 2009

General Safety Example: Blink Digital Electronics TM 1.1 Foundations and The Board Game Counter This sketch (program) will continue to turn on LED on for 1 second and off for 1 second. The sketch (program) includes : setup() function - Initializes variables, pin modes, start using libraries, etc. loop() function - loops code consecutively. // Comments - Detailed descriptions not executed. Project Lead The Way, Inc. Copyright 2009

Example: Blink General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter void - The void keyword is used only in function declarations. It indicates that the function is expected to return no information to the function from which it was called. Project Lead The Way, Inc. Copyright 2009

Example: Blink Syntax: { } Curly Braces General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter Syntax: { } Curly Braces (also referred to as just "braces" or as "curly brackets") Curly Braces are a major part of the C programming language. Balanced Braces - An opening curly brace "{" must always be followed by a closing curly brace "}". Project Lead The Way, Inc. Copyright 2009

General Safety Example: Blink Digital Electronics TM 1.1 Foundations and The Board Game Counter Curly Braces – Beginning programmers, and programmers coming to C from the BASIC language often find using braces confusing or daunting. The same curly braces in C replace: the RETURN statement in a subroutine (function), the ENDIF statement in a conditional and the NEXT statement in a FOR loop in the BASIC language. Project Lead The Way, Inc. Copyright 2009

Example: Blink Syntax: The main uses of { } Curly Braces Functions General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter Syntax: The main uses of { } Curly Braces Functions void myfunction(datatype argument){ statements(s) } Loops while (boolean expression) { statement(s) do } while (boolean expression); for (initialisation; termination condition; incrementing expr) Conditional statements if (boolean expression) { statement(s) } else if (boolean expression) else It is good programming practice to type the closing brace immediately after typing the opening brace when inserting a construct which requires curly braces. Then insert some carriage returns between your braces and begin inserting statements. Project Lead The Way, Inc. Copyright 2009

Example: Blink /* Blink General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give the variable “integer” the name “led”: int led = 13; // the setup routine runs once to declare function when you press reset: void setup() { // initialize the digital pin “pinMode” you defined as “led” as an output. pinMode(led, OUTPUT); } // the void loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW Project Lead The Way, Inc. Copyright 2009

General Safety Example: Blink Digital Electronics TM 1.1 Foundations and The Board Game Counter /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give the variable “integer” the name “led”: int led = 13; A variable is a place for storing a piece of data. It has a type, a name, and a value. For example, the Blink sketch declares a variable with: the type “integer” int, name led, and an initial value = 13; It's being used to indicate which Arduino pin the LED is connected to. Every time the name led appears in the code, its value will be retrieved. Project Lead The Way, Inc. Copyright 2009

Example: Blink Variable Data Types Include: void boolean char General Safety Example: Blink Digital Electronics TM 1.1 Foundations and The Board Game Counter Variable Data Types Include: void boolean char unsigned char byte int unsigned int word unsigned long short float double string - char array String - object Array long Project Lead The Way, Inc. Copyright 2009

Example: Blink General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // give the variable “integer” the name “led”: int led = 13; // the setup routine runs once to declare function when you press reset: void setup() { // initialize the digital pin “pinMode” you defined as “led” as an output. pinMode(led, OUTPUT); } A function (also known as a sub-routine) is a named piece of code that can be used from elsewhere in the code. The setup() function in this example sets the variable led as an OUTPUT. Project Lead The Way, Inc. Copyright 2009

Example: Blink General Safety Digital Electronics TM 1.1 Foundations and The Board Game Counter /* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. The loop() function loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. // the void loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW } Project Lead The Way, Inc. Copyright 2009

Dual-axis Accelerometer General Safety Your Turn Digital Electronics TM 1.1 Foundations and The Board Game Counter Open Source Community Arduino Software is free. You can install it at home if you would like to continue work on your DE projects and/or create new projects of your own. For the newest version of Aurdino IDE visit their website. In the next activities, you will program a microcontroller to integrate new types of sensors and input devices. Memsic 2125 Dual-axis Accelerometer PIR Sensor (Passive Infra-Red) 2-Axis Joystick Project Lead The Way, Inc. Copyright 2009