MICROPROCESSORS A (17.383) Fall Lecture Outline

Similar documents
MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS A (17.383) Fall Lecture Outline

MICROPROCESSORS B (17.384) Spring Lecture Outline

Microprocessors B (17.384) Spring Lecture Outline

Laboratory: Introduction to Mechatronics. Instructor TA: Edgar Martinez Soberanes Lab 1.

MICROPROCESSORS B (17.384) Spring Lecture Outline

MTRX3700 Mechatronics

Procedure: Determine the polarity of the LED. Use the following image to help:

Fireloch 4 Digit 7 Segment Programmable Display Module

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

Before Class Install SDCC Instructions in Installing_SiLabs-SDCC- Drivers document. Solutions to Number Systems Worksheet. Announcements.

Introduction to Microcontroller Apps for Amateur Radio Projects Using the HamStack Platform.

ECE383: Microcomputers Lab 6 Basic and Finite State Machine LED and Switch I/O Programming

ECE2049-E17 Lecture 6 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

Laboratory 10. Programming a PIC Microcontroller - Part II

ME456: Mechatronics. Prof. Clark Radcliffe. Do you have the knack? Joonho Lee, TA. What s Mechatronics? Mechatronics

Microprocessors B Lab 1 Spring The PIC24HJ32GP202

Microprocessors B Lab 3 Spring PIC24/24LC515 EEPROM Interface Using I 2 C

Announcements Homework #3 due today. Ports. Outline for Today C8051 SFRs & Port I/O Worksheet #4 - simple I/O code. Using Ports

PIC Dev 14 Surface Mount PCB Assembly and Test Lab 1

Figure 1.1: Some embedded device. In this course we shall learn microcontroller and FPGA based embedded system.

PIC Dev 14 Through hole PCB Assembly and Test Lab 1

Which LED(s) turn on?

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

ECE2049 E17 Lecture 4 MSP430 Architecture & Intro to Digital I/O

Photoresistor, Transistor, and LED s

Lecture (04) PIC 16F84A programming I

EMBEDDED SYSTEMS COURSE CURRICULUM

ECE2049: Embedded Computing in Engineering Design A Term Fall Lecture #9: Exam Review w/ Solutions

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

ECE Homework #3

The University of Texas at Arlington Lecture 5

16.317: Microprocessor Systems Design I Fall Exam 3 December 15, Name: ID #:

EE251: Thursday September 20

CHIPS Newsletter Vol 5 - Yahoo! Mail. Official Newsletter of

INDUSTRIAL TRAINING:6 MONTHS PROGRAM TEVATRON TECHNOLOGIES PVT LTD

Bolt 18F2550 System Hardware Manual

Product Overview -A 16 bit Micro Experimenter for Solderless Breadboards

ECE2049-E18 Lecture 6 Notes 1. ECE2049: Embedded Computing in Engineering Design E Term Lecture #6: Exam Review

By the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab

Typical applications where a CPLD may be the best design approach:

Microcontroller Overview

Assembly Instructions for 128x64 Graphics Display Unit

Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11

Outline for Today. Lab Equipment & Procedures. Teaching Assistants. Announcements

Linux Kernel Hacking Free Course, 3rd edition. HWMPS: Hardware Monitor & Protection System

Problem Score 1 / 10 2 / 26 3A / 10 3B / 12 3C / 6 4 / code check off / 22 /2 Total /100

Lecture (03) PIC16F84 (2)

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING MSC SYSTEMS ENGINEERING AND ENGINEERING MANAGEMENT SEMESTER 2 EXAMINATION 2016/2017

Announcements. 1. Forms to return today after class:

Course Outline Introduction to C-Programming

CNG 140 C Programming. Syllabus. Course Info Fall Semester. Catalog Description

Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Embedded Systems Module. 6EJ505. C Tutorial 3: using the ICD3 rev tjw

Manual of Board ET-PIC STAMP 18F8722-K22 ET-PIC STAMP 18F8722-K22

ALFRED MAZHINDU

Laboratory Exercise 7 - Extended I/O & Parallel Processing

IME-100 Interdisciplinary Design and Manufacturing

MT2 Introduction Embedded Systems. MT2.1 Mechatronic systems

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors

Microchip 18F4550 Interface, Signal conditioning, USB, USB- RS-232, 16x2 LCD Interface

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Lab 2 - Powering the Fubarino, Intro to Serial, Functions and Variables

Input/Output Ports and Interfacing

PICado Alpha Development Board V1.0

EE 4755 Digital Design Using Hardware Description Languages

MAKING PIC MICROCONTROLLER INSTRUMENTS AND CONTROLLERS

Laboratory: Introduction to Mechatronics

Flow Charts and Assembler Programs

Laboratory of Sensors Engineering Sciences 9 CFU

EE251: Thursday November 30

CSC258: Computer Organization. Memory Systems

Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Embedded Systems and Kinetic Art. CS5968: Erik Brunvand School of Computing. FA3800: Paul Stout Department of Art and Art History.

Logistics. Embedded Systems. Kinetic Art. This Class. Embedded Systems and Kinetic Art. Kinetic Art

Getting acquainted with the development tools June 27, 2006 ELE492 Embedded System Design Exercise 1

Which LED(s) turn on? May 12, 2017 ENGR 40M Spring 2017 C.Z. Lee, J. Plummer, R. Howe 1

TDSDB Features. Description

A Sequence of courses using 8, 16, and 32 bit Microcontroller/DSP Boards

Physics 335 Intro to MicroControllers and the PIC Microcontroller

SquareWear Programming Reference 1.0 Oct 10, 2012

University of Florida EEL 4744 Spring 2014 Dr. Eric M. Schwartz Department of Electrical & Computer Engineering 1 April Apr-14 9:03 AM

Project 17 Shift Register 8-Bit Binary Counter

BCIS 3630 Dr. GUYNES SPRING 2018 TUESDAY SECTION [JAN version] GRADER COURSE WEBSITE

Physics 2660: Fundamentals of Scientific Computing. Lecture 3 Instructor: Prof. Chris Neu

ECE 250 / CS 250 Computer Architecture. C to Binary: Memory & Data Representations. Benjamin Lee

EE251: Tuesday December 4

Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1

Good Idea to Working Electronic Model

Robotic Systems ECE 401RB Fall 2006

COMP3221: Microprocessors and. Embedded Systems

Problem Score 1 / 27 2 / 19 3 / 16 4 / 14 code check off 5 / 22 /2 Total /100

Display Real Time Clock (RTC) On LCD. Version 1.2. Aug Cytron Technologies Sdn. Bhd.

Experiment 4.A. Speed and Position Control. ECEN 2270 Electronics Design Laboratory 1

ECGR 4101/5101, Fall 2015: Lab 7 Digital Oscilloscope

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Information Science 1

Design Progress Report: x10 Environmental Control System Brian Kennedy, David Ramsay University of Rhode Island, Department of Biomedical Engineering

Transcription:

MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 04 September 28, 2010 Dohn Bowden 1

Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework Finish Lab # 2 2

3

Administrative Admin for tonight Syllabus Highlights Exam # 1 next week (October 05, 2010) Lab # 1 is due tonight Lab report for Lab # 2 is due October 19, 2010 No Class on Tuesday October 12, 2010 The 12 th is a Monday Class Schedule 4

Syllabus Review Week Date Topics Lab Lab Report Due 1 09/07/10 Intro, Course & Lab Overview, Microcontroller Basics 1 2 09/14/10 PIC16F684 Overview and General Input/Output 1 con t 3 09/21/10 Switches 2 4 09/28/10 Seven Segment LEDs 2 con t 1 5 10/05/10 Examination 1 X 10/12/10 No Class Monday Schedule 6 10/19/10 Analog to Digital Conversion 3 2 7 10/26/10 Analog to Digital Conversion con t 3 con t 8 11/02/10 LCD Interface and Assembly Language 4 9 11/09/10 Comparators 4 con t 3 10 11/16/10 Timers and Pulse Width Modulation (PWM) 5 11 11/23/10 Mixed C & Assembly Programming/Course Project Project 4 12 11/30/10 Examination 2 13 12/07/10 Course Project Project 5 14 12/14/10 Final Exam/Course Project Brief and Demonstration Demo 5

6

PIC16F684 Interfacing Voltage Regulator Circuit Seven-Segment LEDs 7

Transition From the PICkit 1 Development Board Thus far we have been using the PICkit board All required circuitry was on the board However the board was limited by it s design and components We want to be able to design our own circuits Would be cost prohibited to use the PICkit as our backbone 8

Voltage Regulator Circuit First consideration power requirements Need to power the PIC16F684 and its external interface components 9

Voltage Regulator Circuit 10

LM7805 Pin Connections - Top View LM7805 Pin Connections - Top View 11

Breadboard Locate your circuit near the breadboard terminals Will be using this circuit for all our projects Therefore use minimal space on the board Keep the wiring as short as possible Less EMI issues Test your circuit before you install sensitive components 12

Testing Your Voltage Regulator Voltage checks Oscilloscope 13

Power Indicator Circuit PIC16F684 MUST NOT be removed or installed while energized Therefore add an LED for a visual indication that power is present 470 ohms 14

External Interface Components External interface components A breadboard will allow for additional components not available on the PICkit 1 Additional Switches Additional LEDs Seven-Segment LEDs LCD Displays Etc. 15

The Seven-Segment LED 16

The Seven-Segment LED 17

The Seven-Segment LED LEDs in seven-segment display are not isolated from each other Either all of the cathodes, or anodes, are connected together The other end of each LED is individually available Means fewer electrical connections allows us to easily enable or disable a particular digit by controlling the common lead 18

The Seven-Segment LED Our Labs We will be using the common anode configuration 19

The Seven-Segment LED 20

Lighting Each Digit To light each digit separately, we would need 14 I/O lines on the microcontroller This does not include any other I/O lines needed for items such as switches Therefore, due to the above hardware limitations We will only light one digit at a time, with a process called strobing Strobing 7-segment displays basically involves displaying a number on one display for a short while, and then turning off that display while you display another number on another display 21

Lighting Each Digit The displays are in fact flashing on and off at a high rate of speed, giving the impression that they are constantly on To avoid flickering Each digit must be on at least 50 times per second We will use an electronic switch to select the digit A transistor 22

Transistors The easiest way to understand transistors is to think of them as switches You can switch a big current between the collector and emitter With a much smaller current (in the base) 23

Transistors NPN transistor One mnemonic device for identifying the symbol for the NPN transistor is "not pointing in." PNP transistor One mnemonic device for identifying the symbol for the PNP transistor is "pointing in." 24

NPN transistor as a switch (on) 25

NPN transistor as a switch (off) 26

PNP Transistors While an NPN transistor conducts when a current flows into the base A PNP transistor will conduct when No current flows into the base And stop conducting when A current flows into the base. 27

PNP transistor as a switch (on) 28

PNP transistor as a switch (off) 29

PNP Transistor Our Labs We will be using the PNP Transistor Therefore the transistors we will use will conduct when No current flows into the base And stop conducting when A current flows into the base 30

Microcontroller and 7-Segment LED Circuit 0 = Selected 1 = Not Selected 0 = On 1 = OFF 31

32

33

Programming Commands/instructions that we will encounter tonight C commands PIC16F684 control 34

C commands Learned to Date 35

C commands Learned to Date C program structure Comments # include Integer variables for while NOP() functions 36

C commands Learned to Date (con t) if conditional else else if switch Constant Declaration 37

C commands Learned to Date (con t) Bitwise Operators a == b a!= b a > b a < b a >= b a <= b Tests for equality Test for inequality Greater than Less than Greater than or equal to Less than or equal to 38

New C commands 39

NEW C Commands Bitwise Operators << Shift Left >> Shift Right arrays or look-up tables 40

Bitwise Operators 41

Shifting Bits Another type of useful bitwise operation is the shift We can shift bits either to the left (<<) or to the right (>>) Why use a shift? To perform an operation on a certain bit The bit of interest can be moved to a position where the operation can be performed 42

Binary Operators << Shift Left Drops the number of bits specified on the left Replaced with zeros >> Shift Right Drops the number specified on the right Replaced with zeros 43

<< Shift Left Shift Left by 2 << by 2 1 1 1 0 1 1 0 0 =============== 1 0 1 1 0 0 0 0 We shifted the bit pattern to the left by 2 positions and Replaced bits 0 and 1 positions with two zeros The original bits 6 and 7 have been replaced by bits 4 and 5 44

>> Shift Right Shift Right by 1 >> by 1 1 1 1 0 1 1 0 0 =============== 0 1 1 1 0 1 1 0 We shifted the bit pattern to the Right by 1 position and Replaced in the bit 7 position with a zero The original bit 0 has been replaced with bit 1 45

Applying the Shift Operator to the Microcontroller PICKit1_LEDs = 0b010000; // PORTA value to light D0 We have the above variable in our program code We need to set RA4 equal to the value of the bit in position 4 (the 5 th bit from the right recall we start with bit 0) What is one way of doing that? 46

Applying the Shift Operator to the Microcontroller PICKit1_LEDs = 0b010000; // PORTA value to light D0 RA4 = (PICKit1_LEDs & 0b010000) >> 4; AND (&) 0 1 0 0 0 0 0 1 0 0 0 0 ============ 0 1 0 0 0 0 Shift Right by 4 >> by 4 0 1 0 0 0 0 ============ 0 0 0 0 0 1 Resulting in RA4 equaling 1 47

Arrays or Look-up Tables 48

Arrays or Look-up Tables There are times when you want a variable to hold multiple values For example you may want the variable scores to hold 100 student test scores An array or look-up table is a data structure that can store multiple values of the same type 49

Declaring an Array The array format is as follows: type array_name[size]; To declare an array you must specify: The array Type (int, char, float, etc) Array name Array size To specify the array size you place the number of values that the array can store within brackets that follow the array name 50

Declaring an Array Example int scores[100]; The first array element is located at position zero 0 The last array element is located at [array size 1] Therefore the first is at scores[0]; The last element is at score[99]; 51

Initializing Arrays The following statement initializes the integer array scores to the values 80, 70, 90, 85, and 80 int scores[5] = {80, 70, 90, 85, 80}; You do not need to fill all the space allocated int scores[5] = {80, 70, 90}; Depending on the compiler, it may assign 0 to the elements that you do not assign explicit values 52

Accessing Array Elements Using the previous example int scores[5] = {80, 70, 90, 85, 80}; If we had the following i = 2; scores[i]; Scores would equal scores[i] = 90 Remember with 5 items they will be numbered 0 through 4 53

Alternate Method of Initializing Arrays Initializing arrays without specifying the size of the array If you had the following int scores[] = {80, 70, 90, 85, 80}; An array would be created to just fit the values specified 5 54

Utilizing Arrays With Microcontrollers We could create arrays to hold the PORTA and TRISA values for lighting D0 through D7 LEDs on the PICKit1 const char PORTA_Values[] = { 0b010000, // D0 0b. // D1 0b000010}; // D7 Then set PORTA as follows: PORTA = PORTA_Values[0]; // Sets PORTA = 0b010000 55

General Programming 56

Software Thoughts Re-use your code where possible Copy code that works from one program to another Create yourself a database When writing Code do small pieces at a time Once it s working move to the next part Integrate each part until the code is complete 57

Exam #1 Review 58

Review Exam # 1 Review all the lecture material Basic Microcontroller facts Examples of microcontroller applications How does the Microcontroller compare to the typical of a personal computer? Features and layout of the PIC16F684 PICkit 1 Flash Starter Kit 59

Review Exam # 1 Microchip s MPLAB integrated development environment (IDE) PICC Pro C Compiler Typical Tasks for developing an embedded controller application Know the PIC16F684 Features Understand the Program and Data Memory Configurations 60

Review Exam # 1 PIC16F684 Interfacing Switches LEDs Voltage Regulator Circuit Seven-Segment LEDs 61

Review Exam # 1 - C commands C program structure Comments # include Integer variables for while NOP() functions 62

Review Exam # 1 - C commands (con t) if conditional else else if switch Constant Declaration 63

Review Exam # 1 - C commands (con t) Tests a == b a!= b a > b a < b a >= b a <= b Tests for equality Test for inequality Greater than Less than Greater than or equal to Less than or equal to 64

Review Exam # 1 - C commands (con t) Bitwise Operators << Shift Left >> Shift Right arrays or look-up tables 65

Review Exam # 1 PIC16F684 Control PORTA TRISA PORTC TRISC R&# Configuration Word Numbering Formats 66

Material to Bring to the Exam Electronic versions of all your lab programs Labs 1 and 2 PICkit 1 Flash Starter Kit including the PIC16F684 and USB cable A calculator Your laptop if you use it for programming the PIC16F684 67

ANY QUESTIONS RELATED TO THE EXAM???? 68

69

A look at Lab #1 and Lab #2 Software 70

Software You Used To Control The PICkit #1 Lets look at how you went about developing your software 71

72

Next Class Topics Exam #1 73

74

Homework 1. Study for Exam #1 2. Bring required Exam Materials to class next week 3. Read as required the C commands discussed in today s lecture found in the text (Programming in C) 4. Read the PIC16F684 data manual sections for the registers encountered tonight 5. Finish Lab #2 6. Lab report for Lab # 2 is due October 19, 2010 75

76

References 1. PIC16F684 Data Sheet 41202F 77