Multiplexing seven-segment displays

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

Electrical team Arduino tutorial I BY: JOSHUA arduini
Seven Segment Display. What's A 7-Segment Display? A 7-segment display is a package with 7 bar-shaped LEDs arranged to allow the display of many useful.
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Panasonic EVE-KC2F2024B 24 pulses per revolution 6mm diameter flattened output shaft output type: quadrature (incremental) minimum life: 15,000 rotations.
Programming Microcontrollers B. Furman 19MAR2011.
Using the Arduino to Make an LED Flash Work in teams of two! living with the lab digital I/O pins (I/O = input / output) USB cable plug power pins.
 | bit OR & bit AND ~ bit NOT ^ bit EXLUSIVE OR (XOR) > bit RIGHT SHIFT.
Living with the lab Introduction to Arduino Programming arduino.cc Gerald Recktenwald Portland State University
Digital Outputs 7-Segment Display
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
1 Ultrasonic Distance Sensor. 2 How it Works The distance sensor emits short bursts of sound and listens for this sound to echo off of nearby objects.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Cascade switching of an LED EAS 199B Winter 2013.
Microcontrollers Module 3: Digital Display. 7 – Segment Display A seven-segment display (SSD), or seven- segment indicator, is a form of electronic display.
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.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
BCD S EVEN SEGMENT D ECODER. I NTRODUCTION  A Decoder IC, is a device which converts one digital format into another and the most commonly used device.
Arduino libraries Datatekniker Udvidet hardware/software.
Microcontroller basics Embedded systems for mortals.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
1 Transistor. 2 Transistors are used to turn components on and off They come in all different shapes and sizes.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Arduino.
Microcontroller basics
More on LED’s with Arduino
Fundamentals of Computer Engineering
Microcontroller basics
Segment Identification
UTA010 : Engineering Design – II
Microcontroller 8951S #interface-2.
Cascade switching of an LED
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
Display Devices 7 segment led display.
European Robotic LABoratory
UCD ElecSoc Robotics Club 2017/2018
INC 161 , CPE 100 Computer Programming
Arduino.
Arduino Basics Connect Arduino to USB port
Introduction to Arduino Microcontrollers
Introduction to Arduino Microcontrollers
Roller Coaster Design Project
Electronic Education Kits
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Schedule 8:00-11:00 Workshop: Arduino Fundamentals
What is Arduino? By James Tedder.
Arduino 101 Credit(s):
using the Arduino to make LEDs flash
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Homework Reading Tokheim, Section 5-10, 7-4.
Arduino Part #3 Variables
EET 2261 Unit 8 Seven-Segment Displays
Arithmetic and Decisions
Arduino Part 4 Let there be more light.
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Arduino 7 Segment Display Lab
Aeroponic Engineering and Vertical Farming
Arduino Uno circuit basics
Setting up a basic program with Arduino
SAURABH GINGADE.
Arduino程式範例.
Interrupts.
Presentation transcript:

Multiplexing seven-segment displays

Why multiplex? Arduino (or any other microcontroller) does not have too many pins to connect all segments. For example, four seven-segment displays will need 4 x 7 = 28 segment and 4 power pins, total of 32 pins. Arduino does not have 32 pins. By multiplexing, we just need 11 pins. We will see how.

How to multiplex? Our eyes cannot see if a light flickers faster than 15 times a second. That is why fluorescent lights, TV, movie screens appear to be on, but not flicker. Since there are 4 displays, we need to switch them at 4 x 15 or 60 times a second and they will appear to be on all the time.

Display pins Seven Cathode pins A to G are common to all four displays. We don’t need DP or decimal point. Anode pins Dig1 to Dig4 are used to turn each display on / off; faster than 60 times a second.

Programming the Arduino v1.0 Let us connect Arduino digital pins 0 to 6 to cathode segments A to G. Ignore DP - decimal point. And Arduino digital pins 9, 10, 11 and 12 to DIG1 to DIG4 (Anode pins). Refer to the pin numbers on the display.

Sketch v1.0 Your Setup code. void setup() { // initialize anode pins as output. pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT); pinMode(12, OUTPUT); // initialize cathode pins as output. pinMode(0, OUTPUT); // do the same for other 6 pins 1 to 6. } // can we improvise? Hmmm…..

Sketch 1.1, second try Since digital pins 0 to 6 are connected to PD0 to PD6 of Register D, we can write one line in setup: DDRD = B01111111; This will make all the 7 pins from 0 to 6 as output. 1=output, 0=input

Showing numbers v1.1 Let us show 0 on digit 1. The sequence will be... void loop() { // turn on DIG1 (anode),HIGH on pin 9 digitalWrite(9, HIGH); // now cathodes, output LOW to light a segment digitalWrite(0, LOW); digitalWrite(1, LOW); digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); // 0 does not need the segment G digitalWrite(6, HIGH); // keep it on for 10 mS delay(10); // turn off the display digitalWrite(9, LOW); }

Showing numbers v1.2, second try Earlier, we have seen how to use all the 7 pins together. Let us use the trick here for the cathode pins 0 to 6. void loop() { // turn on dig1 anode, output HIGH on pin 9 digitalWrite(9, HIGH); // again, just one line of code // xgfedcba x,not used, don’t care PORTD = B11000000; // keep it on for 10 mS delay(10); // turn off the display digitalWrite(9, LOW); }

Showing numbers v1.2… cont’d By changing the bit pattern, we can show any number we want. How about number 8? We need all segments to be on, so the code will be, all pins 0 to 6 will be low, or 0. void loop() { // turn on dig1 anode, output HIGH on pin 9 digitalWrite(9, HIGH); // again, just one line of code // xgfedcba x,not used,don’t care PORTD = B10000000; // keep it on for 10 mS delay(10); // turn off the display digitalWrite(9, LOW); }

How to pick other digits? v1.2 Selecting the anode pins 9, 10, 11 or 12, we can choose any of the four digits. Assume we want to show 3 on digit 2. void loop() { // turn on dig2 anode, output HIGH on pin 10 digitalWrite(10, HIGH); // xgfedcba x,not used, don’t care PORTD = B10110000; // keep it on for 10 mS delay(10); // turn off the display digitalWrite(10, LOW); }

Next steps Use an array to store the bit patterns (cathode) for numbers from 0 to 9. This will make your code shorter and more efficient. Use a blinking colon to show the ticking of seconds. Layout your circuit on Fritzing, colour code the wires for easy tracing.

Review Multiplexing reduces pins needed. Sequence is: choose the digit (anode), write the bit pattern (cathode), wait for 10ms (could be 5mS), then turn off the digit. Use the anode pins to choose the digit. Direct Register accessing avoids many lines of pinMode() and digitalWrite() functions, easy to type and efficient. Have fun and Enjoy coding! Come out with v2.0 or v3.0 !!!

Thank you!