ECE 3561 - Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.

Slides:



Advertisements
Similar presentations
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
Advertisements

Code Composer Department of Electrical and Computer Engineering
ECE 382 Lesson 14 Lesson Outline Polling Multiplexing Intro to Logic Analyzer Debouncing Software Delay Routines Admin Assignment 3b due BOC today Assignment.
Lab 7 : Decoders/Encoders : Slide #2 Slide #3 Slide #4 Slide #5 Slide #6 “1 of 10” Encoder “1 of 10” Encoder Connected to a SPST Keypad. Control Signal.
Chung-Ta King National Tsing Hua University
CSC Timers Since this is a microcontroller it mainly finds itself in embedded devices Quite often embedded devices need to synchronize events The.
State Machines Used to Design Sequential Circuits.
ECE 265 – LECTURE 13 Interface to switches and LEDs 7/3/ ECE265.
Input and Output Developed by: Electronic Systems Technologies College of Applied Sciences and Arts Southern Illinois University Carbondale
ECE Lecture 1 1 L15 – Digital I/O Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Digital I/O Connecting to the Outside World
ECE 265 – LECTURE 17 Simulator Project 8/7/ ECE265.
ECE 447 Fall 2009 Lecture 6: TI MSP430 IO Interfacing.
RM2F Input / Output (I/O) Pin grouping code!. I/O Pin Group Operations: The Spin language has provisions for assigning values to groups of bits in the.
Part 1 Using the ARM board And start working with C Tutorial 5 and 6
1 EKT 225 MICROCONTROLLER I CHAPTER 3 I/O PORT PROGRAMMING.
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.
RM2D Let’s write our FIRST basic SPIN program!. The Labs that follow in this Module are designed to teach the following; Turn an LED on – assigning I/O.
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
SE3910 Week 2, Class 1 Today Basic Circuits Other ??? Tomorrow Lab 2, S365 (Complete prelab BEFORE) Thursday See ScheduleSchedule SE-2811 Slide design:
1 ARM University Program Copyright © ARM Ltd 2013 General Purpose I/O.
ECS642U Embedded Systems Digital I/O William Marsh.
Lecturers: Professor John Devlin Mr Robert Ross
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Lecture 16: Digital to Analog Converter - PWM Implementation
IO Subsystem IV Ports and peripherals. IO Subsystem (1) All devices connected to the system buses, other than memory and CPU – Input and output ports.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Warmup – 16FEB2012 This one is for practice. I have paper if you need it. Suppose there are eight, single-pole, single-throw (SPST) switches connected.
Department of Electronic & Electrical Engineering Lecture 2 ● Introduction to IO ● Using a subroutine ● Driving a 7seg display.
Lab 2 page 1 ENT-DIGI-210 Lab 2 Notes ©Paul Godin Updated September 2007.
EE/CS-352: Embedded Microcontroller Systems Part V The 8051 Assembly Language Interrupts.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
ECE 102 Engineering Computation Chapter 11 LabJack Photo Resistor & Mechanical Switch Interface Dr. Herbert G. Mayer, PSU Status 9/2/2015 For use at CCUT.
:Blink Blink: Er. Sahil Khanna
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
Embedded Systems Programming (What they do and when / how to use them)
Switches Electronics 1 CVHS.
Assist. Prof. Rassim Suliyev - SDU 2017
CS4101 嵌入式系統概論 General Purpose IO
Val Manes Department of Math & Computer Science
Microcontroller basics
UTA010 : Engineering Design – II
JC Technology Components.
Chapter 6 General Purpose Input/Output
CS4101 Introduction to Embedded Systems Lab 1: General Purpose IO
Lesson Outline Peripherals Memory-Mapped IO Ports GPIO Multiplexing
Lecture 6: TI MSP430 IO Interfacing
CS4101 嵌入式系統概論 General Purpose IO
Blinking an LED Using MSP430ware to Control GPIO
Programming Boe-Bots (Part 1)
Chapter 2 Push button and Potentiometer
ET 438B Sequential Control and Data Acquisition
ECE 3430 – Intro to Microcomputer Systems
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
8051 Micro Controller.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
CSCI1600: Embedded and Real Time Software
CTY SAR FCPS Shawn Lupoli, Elliot Tan
CS4101 Introduction to Embedded Systems Lab 2: Basic IO and Timer
CSCI1600: Embedded and Real Time Software
Let’s use a PUSH-Button!
Presentation transcript:

ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560

Digital I/O on the 430 Digital input and output Modify the routine to vary the time on/off of each led in oscillation Allow toggle on input from push button ECE Lecture 1 2

There is a MSP 430 wiki page There is a Launch Pad wiki page 430_LaunchPad_(MSP-EXP430G2) ECE Lecture 1 3

Modifying the blink rate We can create two memory locations that modify the blink rate of the LEDs. This will be done in real time in class. ECE Lecture 1 4

Digital input The launch pad has one input available to the user. It is at P1.3 It is a momentary push button switch. The code can be modified to turn the light on when this switch is pressed. Note: There is another momentary push button switch – it is a hard reset. ECE Lecture 1 5

Configure the port The port configuration must be modified to set that pin as an input. It is pin 3 of Port 1 Need to set the value in the P1DIR to xxxx 0xxx To read the value on this switch. When combined with output configuration for the LEDs it give a value of 1xxx 0x1x to be written to P1DIR ECE Lecture 1 6

The code for setting it up Setting the port to read the input switch. Set unused pins to output mov.b #0xF7&P1DIR ;dir register mov.b #0x00,&P1IE;disable int mov.b #0x00,&P1SEL ;all pins I/O mov.b #0x00,&P1OUT ;LEDs off mov.b P1IN,R6 ;read input mov.b P1IN,R6 ECE Lecture 1 7

Consider code in CCS For some reason the switch does not seemed not to work. But it should. Then it was realized The DIRection register should be or $F7 not $FB This is a note slide to show how easy it is to make minor errors that result in errors. Time to revisit and just work with the bit instruction. ECE Lecture 1 8

General scheme to configure To configure – Two alternatives Configure all bits in the control register Configure only the bit you desire to set ECE Lecture 1 9

The flow of control The diagram show the relationships ECE Lecture 1 10

Using diagram The steps to configure pull up First set bit in SEL register to 0 – Digital I/O The set DIR register to 0 – Input From here you configure if you want interrupts (later) – 0 disable for now Also, PxREN – internal pull- up 0 – disabled 1 – enable PxOUT 0 for a pull down 1 for a pull up ECE Lecture 1 11

What is a pull up Port pin can have an internal pull up Possible switch circuits SPDT –Single Pole Double Throw – issue here is that during transition the input is floating. Often see these as DPDT and used in automotive window up/down switch. ECE Lecture 1 12

Switch on input Use a SPST – Single pole single throw Have a connection to Vdd through a limiting resistor. When switch is open Input is at Vdd When switch is closed Input is drawn to ground. Limiting resistor limits current to a low value when closed as there is a path Vdd to GND ECE Lecture 1 13

Typical values for pull up Typical values 5V system so Vdd = 5V Often a pullup resistor of 290Ω or 330Ω is used. So current is Amp or 17 mA (15mA) In 3.3V system – 11 mA (10 mA) When switch is closed this is the current that flows through the resistor. ECE Lecture 1 14

The code to just set that pin Use bit set and bit clear instruction Will do this for Port 1 pin 3 which is the pushbutton switch – a SPST momentary bic.b#0x08,&P1SEL ;I/O bic.b#0x08,&P1DIR;Output bis.b#0x08,,&P1REN;Resistor bis.b#0x08,&P1OUT;Pullup bic.b#0x08,&P1IE;Disable mov.b&P1IN,R6;get value ECE Lecture 1 15

Could be done using bytes This also could have been set using the mov.b instruction. The first attempt with the byte mov instruction failed due to the bit being set wrong in P1OUT so the resistor was a pull down. ECE Lecture 1 16

Good code for bytes mov.b #0x00,&P1SEL;set I/O mov.b #0xF7,&P1DIR;in/out set mov.b #0x08,&P1REN ;res enable mov.b #0x08,&P1OUT ;pullup mov.b #0x00,&P1IE;disable int mov #P1IN,R6 ;read port to R6 val Can see this work in demo ECE Lecture 1 17

Now change light blink code Set up code in iodemo2 for One loop has fast blinking lights-stitch pressed – value is 1 Other has slower blinking lights – switch released – value is 0 How to tell? Use bit – bit test instruction bit #0x08,&P1IN Does a logical and of src,dst so if = 0, switch not pressed, if =1 switch pressed Use JEQ instruction – if Z=0 no jump and code for slower ECE Lecture 1 18

And to watch a code demo Note the code running on the 430 The code for iodemo and iodemo2 is on the webpage. Play with iodemo2 to add code such the blink rate is one rate when the switch is pressed and another when released. ECE Lecture 1 19

Now we can modify We can now modify our led program to change the blinking frequency when we press the switch. File iodemo.asm has core of the code. And a modification is in iodemo2.asm ECE Lecture 1 20

ECE Lecture 1 21 Summary - Assignment Try out the code Add an inner loop to lengthen the time for each individual light. No new assignment.