Microcontrollers, Basics Tips and Tricks with PIC MCUs

Slides:



Advertisements
Similar presentations
1 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Parallel IO Ports E.g. Port T, Port AD Used to interface with many devices Switches LEDs.
Advertisements

Chung-Ta King National Tsing Hua University
What is Arduino?  Arduino is a ATMEL 168 micro-controller kit designed specially for small projects  User friendly IDE(Integrated Development Environment)
Programmable Interval Timer
PS 141 Presentation By Gabe, Tanya Mae Kim, Jaeyoun Ong, Raymond Carey.
Oscilloscope Watch Teardown. Agenda History and General overview Hardware design: – Block diagram and general overview – Choice of the microcontroller.
Embedded Computer ( Sisteme incorporate ) MPU vs. CPU / Alternative Texas Instrument, Freescale, ARM RISC and CISC approaches Single Chip Design System.
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
Arduino. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source.
Digital I/O Connecting to the Outside World
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
Team Members Jordan Bennett Kyle Schultz Min Jae Lee Kevin Yeh.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Timers and Interrupts Shivendu Bhushan Sonu Agarwal.
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
Introduction to the Orbit Edu Board Ahmad Rahmati Teaching Assistant, ELEC424 Rice Efficient Computing Group Sep 12, 2007.
AVR  Modern RISC architecture: Compact and FAST.  Tuned for high level languages.  Consistent architecture across entire line.  Small AVR are subsets.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
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.
Clock Options and Sleep Modes. Clock Sources Flash Fuse bits can be programmed to choose one of the following Clock sources: 1. External RC Osc. f = 1/(3RC).
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
One of the most important feature of the microcontroller is a number of input/output pins used for connection with peripherals. In the case of PIC 167CX,
Lecturers: Professor John Devlin Mr Robert Ross
Digital Electronics Board-of-Education : Input. Board of Education - Input This presentation will explain, both from a hardware and software perspective,
Team 6 DOODLE DRIVE Alexander Curtis Peachanok Lertkajornkitti | Jun Pan | Edward Kidarsa |
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
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. 
CSCI1600: Embedded and Real Time Software Lecture 9: Input Output Concepts Steven Reiss, Fall 2015.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Microcontrollers, Microcomputers, and Microprocessors
Chapter 12 Some PIC Microcontroller Advances The aims of this chapter are to introduce: To introduce in overview two microcontrollers which show some enhanced.
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction Purpose  This course provides an introduction to the peripheral functions.
MICROCONTROLLER INTERFACING WITH STEPPER MOTOR MADE BY: Pruthvirajsinh Jadeja ( ) COLLEGE:DIET BRANCH:EC.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
Case Study #1 Microcontroller System. What is a microcontroller? A microcontroller can be considered a self-contained system with a processor, memory.
Application Case Study Christmas Lights Controller
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION
Fundamentals of Computer Engineering
Microcontrollers, Basics How Do I Choose the Right MCU?
Microcontrollers, Basics Fundamentals of Designing with Microcontrollers 16 January 2012 Jonathan A. Titus.
Microcontrollers, Basics Fundamentals of Digital Debugging
Microcontroller basics
REMOTE JAMMING DEVICE.
Device Interfacing with Python and ZIO
TOUCH CONTROLLED LOAD SWITCH
Microcontroller Applications
Introduction to the Orbit Edu Board
Introduction to Microprocessors and Microcontrollers
Internet-of-Things (IoT)
CSCI1600: Embedded and Real Time Software
Internet-of-Things (IoT)
McCrometer Nano Board Test Procedure
Failure types, Codes, Clearing codes
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
MSP432™ MCUs Training Part 6: Analog Peripherals
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Introduction to Arduino
Arduino Uno circuit basics
CSCI1600: Embedded and Real Time Software
Interrupts.
I/O Experiments Assignment 1.
ECE 3567 Microcontrollers Lab
Presentation transcript:

Microcontrollers, Basics Tips and Tricks with PIC MCUs 20 January 2012 Jonathan A. Titus

General Tips & Tricks I Keep your lab notebook up to date so you know what worked and what didn’t. Always insert your name, time, date, version in your code listings. In large projects, use version-control programs. Do not obfuscate code; keep it clear and readable. Adopt a coding style and use it. Use comments liberally--they take NO code space. If you run into problems, before you do anything else...

General Tips & Tricks II 3 General Tips & Tricks II Check your power supply. Put a ‘scope on the output. Does the supply voltage match the MCU specs? Is the supply current-limit improperly set? Do you have a short circuit? Have you connected the power supply? Don’t use built-in meters, use a calibrated DVM.

General Tips & Tricks III Check jumpers and connectors. Do all boards have a common ground? Do all boards have power? Have you used the latest version of the code and the software tools? Run a simple test program to ensure communication through the debug pod or dev-kit board. Have you selected the proper MCU for the IDE software? Is there a power conflict between your power supply and the debug pod?

Several Keys at One Input I Microchip AN512, Implementing Ohmmeter/Temperature Sensor.

Several Keys at One Input II

Expanded LED Driving Charlieplexing: http://en.wikipedia.org/wiki/Charlieplexing

Resistive-Sensor Interface

Don’t Waste Power in Loops Replace loops that wait for a flag with code that puts the CPU in a low-power mode, then awaken CPU when an event occurs. Don’t do this: while(!ADCInterruptFlag); Do this: while(!ADCInterruptFlag) { Idle(); //wake on ADC interrupt }

Use Internal Pull-Up Resistors

LEDs 1. Use a PWM output to drive an LED and vary brightness. 11 LEDs 1. Use a PWM output to drive an LED and vary brightness. 2. Use a high-brightness LED at low power--you’ll still get good brightness at lower power. 3. If you have an LED to use for diagnostics, connect to an I/O pin with a jumper to free the pin for other uses.

Terminate or Set I/O Pins 1. To reduce power, leave unused I/O pins unconnected, but drive them to a logic 1 or 0. 2. If you have an unused input, connect it to either V+ or ground through a 10K resistor. You lower power use, but add a component. For more power-saving tips, read: Microchip Application Note AN1416, "Low-Power Design Guide."

Comparator Detects Low Battery

Debounce a Switch Interrupt I Not Good: Switch bounce could cause a second interrupt.

Debounce a Switch Interrupt II Better: Clear flag after switch bounce ends.

Filter PWM Output to Get a Voltage

Miscellaneous Tips I Use an internal R-C clock instead of external R-C components. Depends on frequency accuracy you need. Use different clock sources to reduce power. Operate at low clock frequencies Switch to higher-frequency clocks for critical tasks Turn off unused peripherals, if possible. Disable watch-dog timer, if not needed. Look for fast wake-up times, which minimize power use. Include an LED for each power source.

Miscellaneous Tips II Check MCU vendor Web sites and forums for more tips and tricks. Find additional tips, tricks, and sample code on independent sites and discussion groups. For more "Tips and Tricks," visit: http://ww1.microchip.com/downloads/en/DeviceDoc/0114 6B.pdf.

Purchase from Reputable Vendors Ebay looks like it has some “bargains” in development hardware, but don’t trust your career to unknown suppliers. Problems with Chinese AVR JTAG-ICE “knock offs.” Software might not update cloned hardware. Difficult to spot cloned equipment.