Example 5 Pushbutton Switches: S1 and S2

Slides:



Advertisements
Similar presentations
The Important Thing About By. The Important Thing About ******** The important thing about ***** is *****. It is true s/he can *****, *****, and *****.
Advertisements

EUT 1040 Lecture 10: Programmable Logic Controllers.
C and Assembler Subroutines: Using the LCD. Outline Basic structure of CW-created C programs for the HC12 How to incorporate assembly code How to use.
Example 11 Analog-to-Digital Converter Lecture L5.1.
C Language Programming. C has gradually replaced assembly language in many embedded applications. Data types –C has five basic data types: void, char,
The Xilinx CPLD Lecture 4.2. XC9500 CPLDs 5 volt in-system programmable (ISP) CPLDs 5 ns pin-to-pin 36 to 288 macrocells (6400 gates) Industry’s.
6/21/20151 One-Wire Bus Digital Thermometer Example.
Analog-to-Digital Converters
Analog-to-Digital Converters Lecture L11.2 Section 11.3.
Digilab 7-Segment Displays Lab 4. selyInstruction name “000”true if b = a false otherwise = “001”true if b /= a false otherwise “010”true if b < a.
Switches, Pushbuttons, and LEDs Digilent Spartan 3 Board Lecture L2.1.
Programming I/O for Embedded System. Page 2 Overview Basis: A DE2 Computer Architecture Parallel I/O 7-Segment Display Basic Manipulating 7-Segment Display.
© 2007 Cisco Systems, Inc. All rights reserved.ICND1 v1.0—2-1 Module Summary  Ethernet cables and segments can span only a limited physical distance,
Hardware Overview Net+ARM – Well Suited for Embedded Ethernet
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
NetBurner MOD 5282 Network Development Kit MCF 5282 Integrated ColdFire 32 bit Microcontoller 2 DB-9 connectors for serial I/O supports: RS-232, RS-485,
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
COE4OI5 Engineering Design Chapter 2: UP2/UP3 board.
1 4-Integrating Peripherals in Embedded Systems (cont.)
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
Team Members: Ruichen Zhao Xhoua Lor Jen-Yuan Hsiao John Marion.
Multiplexing. PDH Multiplexing Plesiochronous digital hierarchy (PDH) -each TDM stream was derived using a separate timing source -Justification.
The miniDragon+ Board and CodeWarrior Lecture L2.1.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
Digilab2 DIO1 Board. Digilab2 – DIO1 Boards 50 MHz clock mclk Prom socket Spartan IIE.
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Serial Communication Interface Ta Kim Nicholas Earnhart Razid Ahmad ME 6405 – Fall 2008 November 6, 2008.
The Software Construction Process. Computer System Components Central Processing Unit (Microprocessor)
Example 11 Analog-to-Digital Converter Lecture L5.1.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
SIMON Presented By: Amanda Buczkowski James Jenkins Fadi Hanna.
Saxion University of Applied Sciences Advanced Microcontrollers A practical approach.
Real Time Interrupts Section Real-Time Interrupt (RTI) Most operating systems (OS) require an interrupt every T seconds by the RTI RTI interrupts.
WWU Taylor Reijm. LPC bit MCU 512kB Flash Memory 144-pin 20MHz oscillator Used to control TFT touch screen LCD and LCD controller. 1 GPIO used.
1 CCNA 2 v3.1 Module 2 Introduction to Routers Claes Larsen, CCAI.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
Module 8 Tutorial  An 8086 system is used for controlling the speed of a motor. The motor can operate at 5 different speeds (1- 5).  The speed.
Arduino Board SHUBHAM PANCHAL: What is an Arduino? A microcontroller board + programming IDE Microcontrollers & Robotics.
Lecture 10: Programmable Logic Controllers
Mixing C and ASM Programs
Vinculum II Development Modules
4-Integrating Peripherals in Embedded Systems (cont.)
Example 14 Real-time Interrupts
4-Integrating Peripherals in Embedded Systems
Example 19 Measuring Pulse Widths Using Interrupts
4-Integrating Peripherals in Embedded Systems
ECEN 248 Lab 9: Design of a Traffic Light Controller
Example 10 ASCII String to Binary Conversion
Example 9 Binary to ASCII String Conversion
Example 6 Hex Keypad Lecture L3.2.
برنامج (الجداول الحسابية) Microsoft Excel
FPGA Project I: Up/Down Counter w/ Async Reset
Example 15 Interrupt-Driven Controller
Microcontrollers and Microprocessors
Master I/O Connectors PL12 PL14 PL21 PL20 PL17.
Interrupts in C Programs
Camera Component Selection Rationale:
Example 16 Circular Queue
Example 13 The Serial Peripheral Interface (SPI)
Analog-to-Digital Converters
LINECARD Semiconductor - IC Electromechanical Interconnect
Example 17 SCI Receive Interrupts
Example 7 Liquid Crystal Display
Ashley Callaway Pat Doherty Nikeshia Ebron Leo Romanovsky
EE4OI4 Engineering Design
Example 18 Pulse Train Using Interrupts
Electronics for Physicists
Making) Melody timer.
EUT 1040 Lecture 10: Programmable Logic Controllers Unrestricted.
Presentation transcript:

Example 5 Pushbutton Switches: S1 and S2 Lecture L3.1

miniDragon+ 2 pushbutton switches Serial cable A/D Pot I/O headers Run/Load switch Reset button 7-segment display Power plug

Pushbutton Switches: S1 and S2 (PORTAD0 & 0x10) == 0 TRUE if S1 is closed (PORTAD0 & 0x08) == 0 TRUE if S2 is closed

Example 5a // Example 5a: Pushbutton Switches #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void main(void) { PLL_init(); // set system clock frequency to 24 MHz seg7_enable(); // enable 7-segment display ATD0DIEN = 0x18; // enable S1 and S2 while(1){ if((PORTAD0 & 0x10) == 0) seg7dec(1); else seg7_off(); if((PORTAD0 & 0x08) == 0) seg7dec(2); }

Example 5b // Example 5b: Pushbutton Switches using C function calls #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void main(void) { PLL_init(); // set system clock frequency to 24 MHz seg7_enable(); // enable 7-segment display SW12_enable(); // enable S1 and S2 while(1){ if(SW1_down()) seg7dec(1); else seg7_off(); if(SW2_down()) seg7dec(2); }

Example 5

Example 5c // Example 5c: Pushbutton Switches - Problem 5.3 #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" void main(void) { PLL_init(); // set system clock frequency to 24 MHz seg7_enable(); // enable 7-segment display SW12_enable(); // enable S1 and S2 while(1){ while(SW1_down()){ seg7dec(1); } seg7_off(); while(SW2_down()){ seg7dec(2);