27-6-20161 Microprocessors A practical approach..

Slides:



Advertisements
Similar presentations
The 8051 Microcontroller and Embedded Systems
Advertisements

ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
4-1 Timers Timers can be used for  timing  event counting  pulse width measurement  pulse generation  frequency multiplication There are 8 Timers.
C Examples 1.
Slides created by: Professor Ian G. Harris Inputs and Outputs PIC Vcc RA3 RA4 RA5  Make an LED toggle state when button is pressed  Need to read RA3,
Introduction of Holtek HT-46 series MCU
Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.
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.
5-1 Timer/Counters In many microprocessor systems we need to:  count logic pulses  measure the frequency of signals  measure the period of pulses 
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
8051 timer/counter.
8254 Programmable Interval Timer
ECE 371- Unit 11 Timers and Counters (“Stop Watches and Alarm Clocks”)
7/23 Timers in Coldfire Processor Computer Science & Engineering Department Arizona State University Tempe, AZ Dr. Yann-Hang Lee (480)
Timer/counter Chapter 12
ARM Timers.
System Clocks.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
A Few Words From Dilbert
Timers ELEC 330 Digital Systems Engineering Dr. Ron Hayne
Interrupts, Counter and Timers. Interrupts (1) Interrupt-driven I/O uses the processor’s interrupt system to “interrupt” normal program flow to allow.
Timers The timers of the PIC16C7X microcontroller can be briefly described in only one sentence. There are three completely independent timers/counters.
Unit 10.2 Timer Examples. Example – Music Generation Channel 6 – Set up as a timer Output to Generate Square Waves Channel 4 – Set up as a timer Output.
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,
Microprocessors A practical approach Subjects Goals for this module Results Subjects of the module Plans Questions.
1 Lab 1: Introduction. 2 Configure ATMEL AVR Starter Kit 500 (STK500), a prototyping/development board for Lab1. ATmega16 ( V) is the chip used.
Robotraffic software and programming aids Robotics Laboratory Faculty of Mechanical Engineering Technion Israel Institute of Technology.
Lecturers: Professor John Devlin Mr Robert Ross
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
1 68HC11 Timer Chapter HC11 Timer Subsystem Several timing functions: Basic timing Basic timing Real time interrupts Real time interrupts Output.
1 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs.
Timers and Interrupts Anurag Dwivedi. Let Us Revise.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Interrupts  An interrupt is any service request that causes the CPU to stop its current execution stream and to execute an instruction stream that services.
C Examples 1. Download Links dsPIC30F4011/4012 Data Sheet dsPIC30F4013/3014 dsPIC30F Family Reference Manual MikroC MikroC Manual MikroC Quick Reference.
Lecture 41 CSE 341 – Microprocessors Lecture 4 Md. Omar Faruqe UB 1228
Microprocessors A practical approach Lesson 2 Hardware description and Delays.
#1 of 10 Tutorial Introduction PURPOSE -To explain how to configure and use the Timer Interface Module in common applications OBJECTIVES: -Identify the.
PIC16F887.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Programming PIC 16F84A in Assembly. PIC16F84 pin-out and required external components.
Introduction to Projects using Microcontroller Md. Khalilur Rhaman Credit: Interface Lab.
Special Features. Device Configuration bits Revision Device Configuration bits Revision On-chip Power-on Reset (POR) Revision On-chip Power-on Reset (POR)
One more PIC18F252 example and revision for exam B222L Branislav Vuksanovic, UoP, ECE.
TIMERS.
Timer modules in PIC 16F877.  The PIC 16F877 basically has three independent timer modules,  denoted by the symbols, TIMER-0, TIMER1,andTIMER2. . These.
 Mini-Computer ◦ Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output)  Low-Cost.
16F877A.
Microprocessor Systems Design I
Microprocessor Systems Design I
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Microprocessor Systems Design I
Microprocessor Systems Design I
Programmable Interval Timer
Interrupts, Counter and Timers
AVR Addressing Modes Subject: Microcontoller & Interfacing
Microprocessors Timers
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
EECE.3170 Microprocessor Systems Design I
Pugazhendhi.M 11/12/2018 TIMERS 11/12/2018 CCET CCET.
Timer.
Programmable Interval timer 8253 / 8254
PIC18 Timer Programming “Explain the assembly language programming for the timer and counter module”
Programmable Interval timer 8253 / 8254
EECE.3170 Microprocessor Systems Design I
EECE.3170 Microprocessor Systems Design I
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
Presentation transcript:

Microprocessors A practical approach.

Digital input/output

Digital pin configuration and on/off void DS1(void) { PORTC=0; //reset PORTC latches TRISC=0b ; //RC0-RC3 //output else High impedance PORTC.0=1; //RC0 High }

Hardware description

Delays Do,for or while loops Timers, no – interrupts Timers interrupt based.

Delay : Simple loops while (z<1270) {z++; }

Delay : Simple loops(2) Advantage : easy to program Disadvantage: Difficult to make a exact time delay Disadvantage: processor is busy in delay loop.

Delays : Timer Seperate piece hardware. Easy to calculate

Timer 0 8-bit timer/counter Readable and writable 8-bit software programmable prescaler Internal or external clock select Interrupt on overflow from FFh to 00h Edge select for external clock

Timer 0 (2)

Timer 0 (3)

Timer 0 (3) // Delays a multiple of 1 milliseconds at 4 MHz // using the TMR0 timer void Delay_ms( uns16 millisec) { char next = 0; OPTION = 2; // prescaler divide TMR0 rate by 8 TMR0 = 1; // deduct 1*8 fixed instruction cycles delay do { next += 125; while (TMR0 != next) // 125 * 8 *1 us = 1000 us (= 1 ms) ; } while ( -- millisec != 0);}

Timer 0 (3)

Assignment 2a Make 2 programs with 2 variations of a running light. The first program with a simple delay based on a variable. The second program based on TIMER 0

Microprocessoren lesson 3 Digital input and counters

Contents lesson 3 Configuration input pin Switch connecting Bouncing Debouncing Schmitt –trigger input Counting

Program example simple input void init(void) { PORTA=0; //reset PORTA latches TRISA = 0b ; //al pins are input TRISC = 0b ; // al pins output for led ANSEL = 0b ; //All pins as digital I/O } void main( void) { uns8 x; //count value x=0; // set initial value to 0; init(); PORTA=0; while (1) { if (PORTA.2==1) {PORTC.0=1;} else {PORTC.0=0;} //if switch = 5v, //wait until x=0 again to wait for falling edge, wait 10 ms for debouncing }

Program Example bouncing void init(void) { PORTA=0; // reset PORTA latches TRISA = 0b ; // all pins are input TRISC = 0b ; // all pins output for led ANSEL = 0b ; //All pins as digital I/O } void main( void) { uns8 x; //count value x=0; // set initial value to 0; init(); while (1) { if (PORTA.2==1) {x++;while(PORTA.2==1);} //if switch = 5v increment x //,wait until x=0 again to wait for falling edge, wait 10 ms for debouncing PORTC=x; //show x value on led }

Schmitt trigger input

software debounce 1

timer 0 External clock

timer 0 External clock OPTION_REG

Timer 0 configuration for counting with TIMER0 OPTION_REG=0b ; x=TMR0;

Assignment 4 1.Write a program for a that LED shows if the switch (on RA2) is pressed or not. 2.Write a program which shows the bouncing of the switch. 3.Write a program that makes clear that the software debounced the switch. 4.Write a program that counts the switch on a falling edge.(no use of timer0) 5. Write a program that counts the switch on a falling edge. (use :timer0)