Microcontroller Applications

Slides:



Advertisements
Similar presentations
Sensing and Control.
Advertisements

What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Slides created by: Professor Ian G. Harris PIC Development Environment MPLAB IDE integrates all of the tools that we will use 1.Project Manager -Groups.
Data Acquisition Concepts Data Translation, Inc. Basics of Data Acquisition.
The Solar Tracker. Solar Tracking Project Team Members: –Cristian Ruvalcaba –Ken Seal –David Clark –Mark McKinley –Richard DeJarnatt.
Systems Programming Course Gustavo Rodriguez-Rivera.
1-1 Embedded Software Development Tools and Processes Hardware & Software Hardware – Host development system Software – Compilers, simulators etc. Target.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Introduction.
ASPPRATECH.
BLDC MOTOR SPEED CONTROL USING EMBEDDED PROCESSOR
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Programming 8-bit PIC Microcontrollers in C Martin Bates Elsevier 2008.
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.
Silicon Labs ToolStick Development Platform
Department of Electronic & Electrical Engineering Embedded system Aims: Introduction to: Hardware. Software Ideas for projects ? Robotics/Control/Sensors.
Data Converters ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Introduction Purpose This training course covers debugging an application on an SH target in the Renesas HEW (High-performance Embedded Workshop) development.
Programming and Problem Solving ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
ECS642U Embedded Systems Digital I/O William Marsh.
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Chapter 2 Introducing the PIC Mid-Range Family and the 16F84A The aims of this chapter are to introduce: The PIC mid-range family, in overview The overall.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Module Introduction Purpose  This training module provides an overview of the analog interfaces.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training module provides an overview of debugging features.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Microcontroller Applications ELEC 421 Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
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.
Lecture 7: Overview Microprocessors / microcontrollers.
ECE 2799 Electrical and Computer Engineering Design ANALOG to DIGITAL CONVERSION Prof. Bitar Last Update:
Throttle Arduino RC Receiver Stock Golf Cart Motor Controller Motor 1 PWM signal: Voltage: 0 – 5V Period = 22ms Positive Pulse Width: 1ms – 2ms Digital.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
Programming and Debugging with the Dragon and JTAG Many thanks to Dr. James Hawthorne for evaluating the Dragon system and providing the core content for.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
-AT91SAM7X256 – Pulse Width Modulation YoonMo Yeon
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Components of Mechatronic Systems AUE 425 Week 2 Kerem ALTUN October 3, 2016.
CORDLESS MOUSE FEATURES BY TV REMOTE USING PIC MICROCONTROLLER
Application Case Study Christmas Lights Controller
Introduction to Microcontroller Technology
RASH DRIVING WARNING SYSTEM FOR HIGHWAY POLICE
Digital-to-Analog Analog-to-Digital
Scrolling LCD using Arduino.
Application Case Study Security Camera Controller
Microcontroller basics
Timers and Event Counters
AUTOMATIC TEMPERATURE CONTROLLED FAN USING 8051
Programming and Debugging with the Dragon and JTAG
Atmega32 Architectural Overview
ULTRASONIC DISTANCE METER USING 8051
Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)
Timer and Interrupts.
Haiwell PLC Modules Introduce
PC Mouse operated Electrical Load Control Using VB Application
UNIT – Microcontroller.
BITS EDU. CAMPUS , VARNAMA
Introduction to Microcontrollers and the Board of Education
DIGITAL CALCULATOR USING 8051
Arduino - Introduction
RAILWAY TRACK SNAP NOTIFICATION
The Arduino Microcontroller: Atmel AVR Atmega 328
Digital-to-Analog Analog-to-Digital
Introduction to Microprocessors and Microcontrollers
ECE 354 Computer Systems Lab II
Introducing the PIC Mid-Range Family and the 16F84A
CSCI1600: Embedded and Real Time Software
ECE 3567 Microcontroller Lab
CSCI1600: Embedded and Real Time Software
UNIT 5 Analog signals.
Introduction to Arduinos
Presentation transcript:

Microcontroller Applications ELEC 421 Dr. Ron Hayne ELEC 330

Embedded System Typical analog/digital system Transducer A/D converter Converts non-electrical signals into electrical signals A/D converter Converts analog signals into digital signals Digital processor Processes digital data D/A converter Converts digital signals into equivalent analog signals Converts electrical signals into non-electrical signals ELEC 421

Microcontroller Applications Analog to Digital Conversion Interface Analog Sensors (Transducers) Pulse Width Modulation DC Motor Control MPLAB X IDE Programming and Debugging chipKIT Wi-Fire Board PIC32 with lots of I/O H-Bridge Motor Driver Control Speed and Direction ELEC 421

Target System for Development: PIC32MZ EF MIPS32 Warrior M-Class processor core runs the program’s instructions PIC32MZ microcontroller adds memory, control, interfacing and robustness circuits chipKIT Wi-FIRE development board (REV C) adds inputs, outputs and power supply Images courtesy of Digilent and Microchip

PIC32 ADC Input Support Hardware Makes the ADC more flexible Analog Input Voltages Sample & Hold Digital Output Code ADC Sample or hold? Input Channel Select Input multiplexer Sample and hold circuit Allows one ADC to read one of multiple inputs, reducing need for multiple ADCs Samples input voltage before conversion Hold last sampled voltage for conversion by ADC, reducing errors if input voltage changes

Basic Analog-to-Digital Conversion Process Uses software to start conversion and detect completion Select Channel Trigger Conversion Await Conversion Complete Flag Read Data Software Sample & Hold Sample Hold ADC Convert Hardware Data Ready Status Ready Not ready Conversion Result New Result Old result Select analog input channel End of conversion Trigger ADC ADC writes value to result register, updates conversion status flag, may generate interrupt Sample: S&H circuit samples input voltage Hold and convert S&H switches to hold mode ADC converts S&H voltage to a digital value

Potentiometer Connections on Wi-FIRE Board Potentiometer wiper connected to AN8 – analog channel 8 #define VR1_AN_CHAN_NUM (8) Ends of potentiometer resistor connected to 3.3V and 0V (ground) Wiper will have an analog voltage from 0 to 3.3V based on its position

Motivation for Output Compare Module Off Period Off-Time On-Time Enables generation of signals with precise timing Example: Pulse-Width Modulated signal Periodic digital signal with adjustable on-time Duty cycle = fraction of time on, = On-Time/Period Period = On-Time + Off-Time Duty cycle determines average signal level Often used for applications where slow response of user or circuit “averages out” PWM signal Human eye averages out brightness changes which are faster than ~20 Hz (~50 ms) So can dim a light by driving it with a PWM signal with a period under 50 ms Also: servo motor position, electric heater control, power conversion electronics, motor speed control, … Example: Duty Cycle 73% On Off 10 ms 7.3 ms 2.7 ms Average value 73%

Hardware Implementation: Output Compare Module Use TMRy value to control when output OCx changes Compare TMRy against output compare registers OCxR, OCxRS OCxR OCxRS Logic OCx Equal Comparator TMRy PRy Comparator Clock Input Equal Reset OCxCON

Dual H-Bridge Motor Driver ELEC 421

PICKit 3 Programmer/Debugger ELEC 421

Building and Downloading Code MPLAB X IDE We are using the XC32 toolchain Download Controls xc32-as assembler xc32-gcc C compiler Build the files which have changed, and dependent files xc32-g++ C++ compiler xc32-ld linker/loader Delete all temporary files and rebuild all files xc32-ar archive (library) manager Download executable to MCU flash memory Upload executable from MCU flash memory Debug the program

Running Code with the Debugger We can download the code to the MCU and let it run Hard to know what the program is doing and why We will perform on-chip debugging to monitor and control the program as it runs on the MCU Start debugging: Debugger features Program execution control options Start, pause, reset program Breakpoints: pause program if it reaches this code Program inspection options Variable watches Function call stack

Program Execution Control Options Exit debugger (Shift-F5) Continue running program – run until paused or breakpoint reached (F5) Pause program – temporarily stop program execution Reset program – next run starts from beginning Step over function – execute entire function, pause (F8) Step into function – enter function, pause before executing (F7) Run to cursor – run to code corresponding to current cursor location (F4) Set PC at cursor – update program counter to code at cursor Focus cursor at PC – update window to show code for current PC PC (Program counter) value – address of next instruction to execute

Using Breakpoints Use breakpoints to pause program execution at a specific point in the program If processor tries to execute code at a breakpoint, it will pause the program and give control to the debugger Now you can examine and change variables, step through the program to see what executes next, etc. Set/remove breakpoints by Left-clicking in gray column, or Right-clicking on source code and selecting “Toggle Line Breakpoint” Limited number of hardware breakpoints in processor (8). Need one free to single-step program execution

Monitoring Program Data Variable watch window allows you to see a variable’s value (and even change it) Also shows other information: data type, address Can add a variable to this window by… Right-clicking on variable name in source code window and selecting “New Watch…” Typing in name of variable in here variable window: Or clicking on Add Watch icon Can see variable’s value by hovering cursor over variable name in source code

Microcontroller Applications Analog to Digital Conversion Interface Analog Sensors (Transducers) Pulse Width Modulation DC Motor Control MPLAB X IDE Programming and Debugging chipKIT Wi-Fire Board PIC32 with lots of I/O H-Bridge Motor Driver Control Speed and Direction ELEC 421