Digital Design through Pi

Similar documents
Digital Design through Arduino

Assembly Programming through Arduino

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

S.Y. Diploma : Sem. III [DE/ED/EI/EJ/EN/ET/EV/EX/IC/IE/IS/IU/MU] Principles of Digital Techniques

Sample Test Paper - I

CHAPTER 7. Exercises 17/ / /2 2 0

( c) Give logic symbol, Truth table and circuit diagram for a clocked SR flip-flop. A combinational circuit is defined by the function

Signals and Systems Digital Logic System

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

WORKBOOK. Try Yourself Questions. Electrical Engineering Digital Electronics. Detailed Explanations of

CSE 140L Spring 2010 Lab 1 Assignment Due beginning of the class on 14 th April

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Digital Electronics Circuits 2017

Digital Electronic Meters

Exam for Physics 4051, October 31, 2008

A B D 1 Y D 2 D 3. Truth table for 4 to 1 MUX: A B Y 0 0 D D D D 3

Reg. No. Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER Second Semester. Computer Science and Engineering

Save from: cs. Logic design 1 st Class أستاذ المادة: د. عماد

Digital Circuits ECS 371

SIR C.R.REDDY COLLEGE OF ENGINEERING ELURU DIGITAL INTEGRATED CIRCUITS (DIC) LABORATORY MANUAL III / IV B.E. (ECE) : I - SEMESTER


Lab 3 Revisited. Zener diodes IAP 2008 Lecture 4 1

Design of Combinational Logic

Z = F(X) Combinational circuit. A combinational circuit can be specified either by a truth table. Truth Table

Layout of 7400-series Chips Commonly Used in. CDA 3101: Introduction to Computer Hardware and Organization

Experiment 9 Sequential Circuits

EXPERIMENT Bit Binary Sequential Multiplier

Contents. Chapter 3 Combinational Circuits Page 1 of 36

Digital Circuits. 1. Inputs & Outputs are quantized at two levels. 2. Binary arithmetic, only digits are 0 & 1. Position indicates power of 2.

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques


Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Digital Electronics Final Examination. Part A

04. What is the Mod number of the counter circuit shown below? Assume initially reset.

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package. *MR for LS160A and LS161A *SR for LS162A and LS163A

Chapter 4: Combinational Logic Solutions to Problems: [1, 5, 9, 12, 19, 23, 30, 33]

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) State any two Boolean laws. (Any 2 laws 1 mark each)

Design at the Register Transfer Level

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

ECE 341. Lecture # 3

Schedule. ECEN 301 Discussion #25 Final Review 1. Date Day Class No. 1 Dec Mon 25 Final Review. Title Chapters HW Due date. Lab Due date.

DIGITAL LOGIC DESIGN

CHW 261: Logic Design

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

NTE74176 Integrated Circuit TTL 35Mhz Presettable Decade Counter/Latch

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

Digital Logic Appendix A

DE58/DC58 LOGIC DESIGN DEC 2014

Combinational Digital Design. Laboratory Manual. Experiment #6. Simplification using Karnaugh Map

Digital Signal 2 N Most Significant Bit (MSB) Least. Bit (LSB)

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Random Number Generator Digital Design - Demo

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Computer Science Final Examination Friday December 14 th 2001

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

Shift Register Counters

PAST EXAM PAPER & MEMO N3 ABOUT THE QUESTION PAPERS:

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Digital Electronics. Part A

Hands-on Lab 3. System Identification with Experimentally Acquired Data

Number System conversions

Fundamentals of Boolean Algebra

ENEL Digital Circuit Design. Final Examination

Philadelphia University Student Name: Student Number:

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Lecture 8: Sequential Networks and Finite State Machines

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6201 DIGITAL PRINCIPLES AND SYSTEM DESIGN

ECE20B Final Exam, 200 Point Exam Closed Book, Closed Notes, Calculators Not Allowed June 12th, Name

Boolean Logic Prof. James L. Frankel Harvard University. Version of 3:20 PM 29-Aug-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved.

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

University of Florida EEL 3701 Fall 2014 Dr. Eric. M. Schwartz Department of Electrical & Computer Engineering Wednesday, 15 October 2014

Digital Fundamentals

Analog & Digital Electronics Laboratory. Code - CS391. Lab Manual

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

NTE74177 Integrated Circuit TTL 35Mhz Presettable Binary Counter/Latch

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Design of Sequential Circuits

Combinational Logic. Course Instructor Mohammed Abdul kader

Advanced Boolean Logic and Applications to Control Systems

Chapter 5 Synchronous Sequential Logic

Boolean Logic Continued Prof. James L. Frankel Harvard University

5 8 LED MAX6950/MAX6951 MAX6950/MAX6951 SPI TM QSPI TM MICROWIRE TM 7 LED LED 2.7V MAX LED MAX LED 16 (0-9 A-F) RAM 16 7 LED LED

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

Digital Circuits, Binary Numbering, and Logic Gates Cornerstone Electronics Technology and Robotics II

per chip (approx) 1 SSI (Small Scale Integration) Up to 99

Introduction to Karnaugh Maps

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

Karnaugh Map & Boolean Expression Simplification

Systems I: Computer Organization and Architecture

RAO PAHALD SINGH GROUP OF INSTITUTIONS BALANA(MOHINDER GARH)123029

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

UNIT II COMBINATIONAL CIRCUITS:

Transcription:

1 Digital Design through Pi G V V Sharma Contents 1 Display Control through Hardware 1 1.1 Components......... 1 1.2 Software Setup........ 1 1.3 Powering the Display.... 1 1.4 Controlling the Display... 2 2 Display Control through Software 3 2.1 Driving the Segments.... 3 2.2 Counting Decoder...... 4 2.3 Display Decoder....... 5 3 Decade Counter through Flip-Flops 5 References 5 Abstract This manual covers the entire breadth of digital design by building a decade counter using a Raspberry Pi. In the process, boolean logic, combinational logic and sequential logic are covered. Component Value Quantity Breadboard 1 Resistor 220Ω 1 Pi Model 1 B, Rev 3 Seven Segment Common 1 Display Anode Decoder 7447 1 Flip Flop 7474 2 Jumper Wires Female- Male 20 TABLE 1.1 g i t c l o n e g i t :// g i t. drogon. n e t/ w i r i n g P i cd / w i r i n g P i./ b u i l d 1 Display Control through Hardware 1.1 Components The components required for this manual are listed in Table 1.1 1.2 Software Setup The following commands will install the Wiring Pi module [2] sudo apt g e t i n s t a l l g i t c o r e sudo apt g e t u p d a t e sudo apt g e t upgrade cd *The author is with the Department of Electrical Engineering, Indian Institute of Technology, Hyderabad 502285 India e-mail: gadepall@iith.ac.in. All content in this manual is released under GNU GPL. Free and open source. 1.3 Powering the Display The breadboard can be divided into 5 segments. In each of the green segements, the pins are internally connected so as to have the same voltage. Similarly, in the central segments, the pins in each column are internally connected in the same fashion as the blue columns. Problem 1.1. Plug the display to the breadboard in Fig. 1.1 The seven segment display in Fig. 1.2 has eight pins, a, b, c, d, e, f, g and dot that take an active LOW input, i.e. the LED will glow only if the input is connected to ground. Each of these pins is connected to an LED segment. The dot pin is reserved for the LED.

2 do you observe? 1.4 Controlling the Display Fig. 1.6 explains how to get decimal digits using the seven segment display. Fig. 1.1 Problem 1.6. Generate the number 1 on the display by connecting only the pins b and c to GND. Problem 1.2. Connect one end of the resistor to the COM pin of the display and the other end to an extreme pin of the breadboard. b=0 a=0 b=0 g=0 g f COM a b c=0 e=0 d=0 a Fig. 1.6 f g b Problem 1.7. Repeat the above exercise to generate the number 2 on the display. e d c dot Problem 1.8. Table 1.8 summarizes the process of generating the decimal digits. 0 means connecting to ground and 1 means not connecting. Complete Table 1.8 for all numbers between 0-9. e d COM c dot Fig. 1.2 The Raspberry Pi 3 has 40 pins (see Figs. 2.1.1 and 2.1.2), which include power pins that can generate 5V and 3.3V, GND pins, PWM pins, pins for wired communication and some free pins for digital I/O. In the following exercises, only the GND, 5V and digital I/O pins will be used. Problem 1.3. Connect pin 2 (5V) of the Pi to an extreme pin that is in the same segment as the resistor pin. Problem 1.4. Connect pin 6 (GND) of the Pi to the opposite extreme pin of the breadboard Problem 1.5. Connect the dot pin of the display to a pin in the same segment as the GND pin. What a b c d e f g decimal 1 0 0 1 1 1 1 1 0 0 1 0 0 1 0 2 TABLE 1.8 Problem 1.9. Now generate all numbers between 0-9 on the display using the above table. The 7447 IC helps in displaying decimal numbers on the seven segment display. The ā ḡ, pins of the 7447 IC are connected to the a g pins of the display. V cc should be connected to a 5V power source. The input pins of the decoder are A,B,C and D, with A being the lowest significant bit (LSB) and D being the most significant bit (MSB). For example, the number 5 is visible on the display when the A,B,C and D inputs are the following. D C B A Decimal 0 1 0 1 5

3 V CC 16 f 15 ḡ 14 ā 13 b 12 c 11 d 10 ē 9 7447 1 2 3 4 5 6 7 8 B C D A GND Fig. 1.9 Problem 1.10. Connect the 7447 IC decoder ā ḡ pins to the a g pins of the display respectively. Problem 1.11. Connect the V cc and GND pins of the decoder to the 5V supply and GND pins of the breadboard. Problem 1.12. Connect the A,B,C,D pins to pins in the GND extreme segment of the breadboard. What do you observe. Problem 1.13. Now remove the D pin from the breadboard and observe the display output. Problem 1.14. Generate a table with A,B,C,D inputs and the equivalent decimal number output. 2 Display Control through Software 2.1 Driving the Segments Problem 2.1. Connect the A-D pins of the 7447 IC in Fig. 1.9 to the GPIO pins 0-3 of the Pi shown in Figs. 2.1.1 and 2.1.2. Fig. 2.1.2: GPIO Wiring Pi [2] pin configuration. Fig. 2.1.1: GPIO pin snapshot on Pi [1]. Problem 2.2. Type the following code and execute. What do you observe? pinmode ( 0, OUTPUT) ; pinmode ( 1, OUTPUT) ; pinmode ( 2, OUTPUT) ; pinmode ( 3, OUTPUT) ; d i g i t a l W r i t e ( 0, 1) ; d i g i t a l W r i t e ( 1, 0) ; d i g i t a l W r i t e ( 2, 1) ; d i g i t a l W r i t e ( 3, 0) ;

4 Z Y X W D C B A 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0 TABLE 2.4 //Command f o r r a s p b e r r y p i // Save f i l e as bcd seven. c // gcc Wall o t e s t bcd seven. c l w i r i n g P i // f o l l o w e d by // sudo./ t e s t Problem 2.3. Now generate the numbers 0-9 by modifying the above program. 2.2 Counting Decoder In the truth table in Table 2.4, W, X, Y, Z are the inputs and A, B, C, D are the outputs. This table represents the system that increments the numbers 0-8 by 1 and resets the number 9 to 0 Note that D=1for the inputs 0111 and 1000. Using boolean logic, D=WXYZ + W X Y Z (2.3.1) Note that 0111 results in the expression WXYZ and 1000 yields W X Y Z. Problem 2.4. Write the boolean logic functions for A, B, C in terms of W, X, Y, Z. Problem 2.5. Write a program for implementing Table 2.4. Solution: i n t Z=0,Y=0,X=1,W=1; i n t D, C, B,A; pinmode ( 0, OUTPUT) ; pinmode ( 1, OUTPUT) ; pinmode ( 2, OUTPUT) ; pinmode ( 3, OUTPUT) ; D = (W&&X&&Y&&!Z ) (!W&&!X&&!Y &&Z ) ; C = (W&&X&&!Y&&!Z ) (!W&&!X&&Y &&!Z ) (W&&!X&&Y&&!Z ) (!W &&X&&Y&&!Z) ; B = (W&&!X&&!Y&&!Z ) (!W&&X&&! Y&&!Z ) (W&&!X&&Y&&!Z ) (! W&&X&&Y&&!Z) ; A = (!W&&!X&&!Y&&!Z) (!W&&X &&!Y&&!Z ) (!W&&!X&&Y&&!Z ) (!W&&X&&Y&&!Z) (!W&&!X &&!Y&&Z) ; d i g i t a l W r i t e ( 0, A) ; d i g i t a l W r i t e ( 1, B) ; d i g i t a l W r i t e ( 2, C) ; d i g i t a l W r i t e ( 3, D) ; Problem 2.6. Verify if your logic is correct by observing the output on the seven segment display for different inputs. Problem 2.7. Connect GPIO pin 10 to the dot pin of the display and execute the following code. pinmode ( 1 0, OUTPUT) ; d i g i t a l W r i t e ( 1 0, HIGH) ; d e l a y ( 5 0 0 ) ; d i g i t a l W r i t e ( 1 0, LOW) ; d e l a y ( 5 0 0 ) ;

5 Problem 2.8. A decade counter counts the numbers from 0-9 and then resets to 0. Suitable modify the above programs to obtain a decade counter. 2.3 Display Decoder Problem 2.9. Now write the truth table for the seven segment display decoder (IC 7447). The inputs will be A, B, C, D and the outputs will be a, b, c, d, e, f, g. Problem 2.10. Obtain the logic functions for outputs a, b, c, d, e, f, g in terms of the inputs A, B, C, D. Problem 2.11. Disconnect the Pi from IC 7447 and connect the pins GPIO 0-6 in the Pi directly to the seven segment display. Problem 2.12. Write a new program to implement the logic in Problem 2.10 and observe the output in the display. You have designed the logic for IC 7447! Problem 2.13. Now include your counting decoder program in the display decoder program and see if the display shows the consecutive number. Problem 3.3. Connect the 11-14 pins of the Pi to the D input pins of two 7474 ICs. Use the 11-14 pins as Pi output. Problem 3.4. Connect pin 10 of the Pi to the CLK inputs of both the 7474 ICs. Problem 3.5. Connect pins 1,4,10 and 13 of both the 7474 ICs to 5V. Problem 3.6. Using the logic for the counting decoder in the Pi software, implement the decade counter. References [1] [Online]. Available: http://pi4j.com/pins/model-2b-rev1.html [2] [Online]. Available: http://wiringpi.com/ 3 Decade Counter through Flip-Flops The 7474 IC in Fig. 3.0 has two D flip flops. The D pins denote the input and the Q pins denote the output. CLK denotes the clock input. V CC 14 13 D2 12 CLK2 11 10 Q2 9 8 7474 1 2 3 4 5 6 7 D1 CLK1 Q1 GND Fig. 3.0 Problem 3.1. Connect the 0-3 pins of the Pi to the Q pins of the two 7474 ICs. Use the 0-3 pins as Pi input. Problem 3.2. Connect the Q pins to IC 7447 Decoder as input pins. Connect the 7447 IC to the seven segment display.