EE 109 Midterm Review

Similar documents
EE292: Fundamentals of ECE

Chapter 1 Binary Systems

EXERCISE 4: A Simple Hi-Fi

Embedded Systems and Software. Analog to Digital Conversion

Number system: the system used to count discrete units is called number. Decimal system: the number system that contains 10 distinguished

Lecture #4 Outline. Announcements Project Proposal. AVR Processor Resources

Microcontroller Systems. ELET 3232 Topic 21: ADC Basics

EECS 452 Midterm Exam Winter 2012

Asst. Prof. Thavatchai Tayjasanant, PhD. Power System Research Lab 12 th Floor, Building 4 Tel: (02)

DIGITAL ELECTRONICS QUESTION BANK

Analogue to Digital Conversion on an ATmega168

1. The decimal number 62 is represented in hexadecimal (base 16) and binary (base 2) respectively as

Application Note: Using the Motor Driver on the 3pi Robot and Orangutan Robot Controllers

B.C.A 2017 DIGITAL ELECTRONICS BCA104T MODULE SPECIFICATION SHEET. Course Outline

Analog I/O. ECE 153B Sensor & Peripheral Interface Design Winter 2016

ROTRONIC HygroClip Digital Input / Output


Appendix C. LW400-09A Digital Output Option

Electronics. Digital Electronics

EE 308 Apr. 24, 2002 Review for Final Exam

Chapter 1: Digital logic

Objective Questions. (a) Light (b) Temperature (c) Sound (d) all of these

EE 308 Spring S12 SUBSYSTEMS: PULSE WIDTH MODULATION, A/D CONVERTER, AND SYNCHRONOUS SERIAN INTERFACE

Unit 24: Controlling Systems Using IT

Quartus II Simulation with Verilog Designs

Laboratory 11. Pulse-Width-Modulation Motor Speed Control with a PIC

Dr. Nicola Nicolici COE/EE2DI4 Midterm Test #1 Oct 18, 2006

6.111 Lecture # 15. Operational Amplifiers. Uses of Op Amps

Real time digital audio processing with Arduino

Quartus II Simulation with Verilog Designs

Arduino Microcontroller Processing for Everyone!: Third Edition / Steven F. Barrett

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Digital-to-Analog Converter

PIC Functionality. General I/O Dedicated Interrupt Change State Interrupt Input Capture Output Compare PWM ADC RS232

Unit D. Serial Interfaces. Serial vs. Parallel. Serial Interfaces. Serial Communications

Digital Electronics Course Objectives

A Beginners Guide to AVR

Chapter 10 Error Detection and Correction 10.1

Hashemite University Faculty of Engineering Mechatronics Engineering Department. Microprocessors and Microcontrollers Laboratory

EE 308 Lab Spring 2009

Lecture 02: Digital Logic Review

DESIGN OF 4 BIT BINARY ARITHMETIC CIRCUIT USING 1 S COMPLEMENT METHOD

CS302 Digital Logic Design Solved Objective Midterm Papers For Preparation of Midterm Exam

LOGIC DIAGRAM: HALF ADDER TRUTH TABLE: A B CARRY SUM. 2012/ODD/III/ECE/DE/LM Page No. 1

Portland State University MICROCONTROLLERS

Winter 14 EXAMINATION Subject Code: Model Answer P a g e 1/28

CS1800 Discrete Structures Fall 2016 Profs. Aslam, Gold, Ossowski, Pavlu, & Sprague 7 November, CS1800 Discrete Structures Midterm Version C

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates

Computer Architecture Lab Session

The University of Texas at Arlington Lecture 10 ADC and DAC

Hardware and software resources on the AVR family for the microcontroller project

DIGITAL CIRCUITS AND SYSTEMS ASSIGNMENTS 1 SOLUTIONS

CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS

Lecture 2. Digital Basics

EE 308: Microcontrollers

Embedded Hardware Design Lab4

This Errata Sheet contains corrections or changes made after the publication of this manual.

Combinational Logic Circuits. Combinational Logic

SRV ENGINEERING COLLEGE SEMBODAI RUKMANI VARATHARAJAN ENGINEERING COLLEGE SEMBODAI

Lab Exercise 6: Digital/Analog conversion

Digital Design Laboratory Lecture 7. A/D and D/A

Lecture 2: Data Representation

Grundlagen Microcontroller Analog I/O. Günther Gridling Bettina Weiss

Module 13: Interfacing ADC. Introduction ADC Programming DAC Programming Sensor Interfacing

SE311: Design of Digital Systems Lecture 1: Introduction to Digital Systems

Computerized Data Acquisition Systems. Chapter 4

D3 04AD 4-Channel Analog Input

DI-1100 USB Data Acquisition (DAQ) System Communication Protocol

8-Bit A/D Converter AD673 REV. A FUNCTIONAL BLOCK DIAGRAM

Chapter 7. Introduction. Analog Signal and Discrete Time Series. Sampling, Digital Devices, and Data Acquisition

Part 1: DC Concepts and Measurement

CPSC 226 Lab Four Spring 2018

Exam #2 EE 209: Fall 2017

Digital Electronics. A. I can list five basic safety rules for electronics. B. I can properly display large and small numbers in proper notation,

Embedded Systems. Oscillator and I/O Hardware. Eng. Anis Nazer First Semester

IES Digital Mock Test

Digital Logic Circuits

Review for Final Exam

1.) If a 3 input NOR gate has eight input possibilities, how many of those possibilities result in a HIGH output? (a.) 1 (b.) 2 (c.) 3 (d.) 7 (e.

F3 16AD 16-Channel Analog Input

University of California, Berkeley EE128, Fall Lab 7 A Microcontroller Based Position/Speed Controller

Roland Kammerer. 13. October 2010

Operational Amplifiers (Op Amps)

VCE VET ELECTRONICS. Written examination. Friday 1 November 2002

F3 08AD 1 8-Channel Analog Input

B RoboClaw 2 Channel 30A Motor Controller Data Sheet

A MORON'S GUIDE TO TIMER/COUNTERS v2.2. by

LIST OF EXPERIMENTS. KCTCET/ /Odd/3rd/ETE/CSE/LM

Lab 5. Binary Counter

Digital Applications (CETT 1415) Credit: 4 semester credit hours (3 hours lecture, 4 hours lab) Prerequisite: CETT 1403 & CETT 1405

Combinational Circuits: Multiplexers, Decoders, Programmable Logic Devices

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

CONTENTS Sl. No. Experiment Page No

Introduction. BME208 Logic Circuits Yalçın İŞLER

Lab 6. Binary Counter

µpad: Proto Base Manual

Embedded Systems and Software

uc Crash Course Whats is covered in this lecture Joshua Childs Joshua Hartman A. A. Arroyo 9/7/10

University of California at Berkeley Donald A. Glaser Physics 111A Instrumentation Laboratory

ELECTRONICS ADVANCED SUPPLEMENTARY LEVEL

128 KB (128K 1 = 128K

Transcription:

EE 109 Midterm Review 1

2 Number Systems Computer use base 2 (binary) 0 and 1 Humans use base 10 (decimal) 0 to 9 Humans using computers: Base 16 (hexadecimal) 0 to 15 (0 to 9,A,B,C,D,E,F) Base 8 (octal) 0 to 7 Value of a number is calculated by the summing the coefficients (digits) times the radix raised to a power. 326 10 = 3 10 2 + 2 10 1 +6 10 0 11010 2 = 1 2 4 + 1 2 3 + 0 2 2 + 1 2 1 + 0 2 0 = 26 10 C7 16 = 12 16 1 + 7 16 0 = 199 10 Converting between hex and binary: 2->16: Separate bits into groups of 4 and write equivalent hex digit 16->2: Write out bits for each hex digit.

3 Number Systems Converting decimal to (unsigned) binary: Start with largest power of 2 less than the decimal number Coefficient for that power will be a one Subtract that power of 2 from the decimal number Repeat Example: 41 10 to base 2 Find powers of 2 that add up to 41 starting with larger ones first (like making change) 41 32 = 9 9 8 = 1 1 1 = 0 41 10 = 32 + 8 + 1 = 1 2 5 + 0x2 4 + 1 2 3 + 0 2 2 + 0 2 1 + 1 2 0 = 101001 2

4 Unsigned Numbers Used to represent only positive numbers In n bits can represent numbers from 0 to +2 n -1 Example: 8 bits can range from 0 to 255

5 Signed Numbers Have to represent negative numbers by using 1 s and 0 s (no sign) Several methods have been used Sign-magnitude: Use the leading bit to represent the sign of the number (0=+, 1= ) 0101 = +5 1101 = 5 In n bits can represent numbers from (2 n-1-1) to +2 n-1-1 Problems: Two versions of zero (0000 and 1000) Difficult to use with hardware. Have to make tests to see how to do adds and subtracts.

6 Signed Numbers 2 s complement: Negative numbers are the 2 s complement of the positive number. MSB has a value of -2 n-1 0101 = +5 1011 = -5 (-8 + 2 + 1 = -5) In n bits can represent numbers from 2 n-1 to +2 n-1-1 Remember: A 2 s complement number is not necessarily a negative number. 2 s complement is way of representing a range of positive AND negative numbers. Advantages No problem with two zeros. Easier to use with hardware.

7 Practice Show in hex the representation of: char x = -92; short int x = -2; unsigned int x = 512;

8 Binary Codes Binary values can be defined to represent any number of different things. ASCII character set 128 characters (7-bits) Unicode lots of characters Instructions (ADD, SUB, etc.) Conditions (Error, ready, out of paper, etc.) Defined by user.

9 Logical Operations All computers circuits are based on a small number of logical elements. AND output is true if ALL inputs are true OR output is true if ANY input is true NOT output is the logical complement of the input By combining many of these logical elements we can build any complex circuit we want. Combinational Logic: The output of a circuit only depends on the CURRENT inputs No memory of past inputs or outputs Sequential Logic: The output of a circuit depends on the current inputs and past states and inputs to the circuit. Circuit has memory.

10 Practice Find the output values of F and G for inputs: ABC=011 ABC=001 ABC=110 A B F C G

11 Registers [Note: we did not spend too much time on this but we'll just review it briefly] The fundamental building block of sequential circuits is the flip-flop which stores one bit. When clocked, the flip-flop stores the current input bit. The flip-flop always outputs whatever bit is stored in it. Most common is the Edge-triggered D flip-flop Bit is stored on the transition (edge) of the clock signal. Register = collection of flip-flops controlled by the same clock signal. All the elements of a register store their input bits at the same time.

12 Electrical Circuits Current amount of charge flowing through a point Measured in Amps Denoted by I Voltage potential energy that can cause charge to move. Measured in Volts between two points Denoted by V Ground a point of reference for measuring voltages Usually connected to the negative side of the power source.

13 Electrical Circuits Kirchoff s Current Law Amount of current flowing into a point must equal the amount flowing out of the same point. Kirchoff s Voltage Law Sum of the voltages around a complete loop must equal zero.

14 Electrical Circuits Resistance Makes it harder for current to flow, must use more voltage to cause charge to move. Ohm s Law: V = IR Resistors in series Equivalent resistance is the sum of the individual resistances Resistors in parallel Equivalent resistance is reciprocal of the sum of the individual reciprocals of the resistances A resistor of 0 ohms = a wire A resistor of inf. ohms = an open circuit (i.e. no connection) R R=0 R=inf

15 Practice Find the current i1 in terms of Vs and the resistors Find the voltage V2 in terms of Vs and the other resistors If R3=0 ohms what's the voltage V2? i1 Vs R1 + V1 - R2 + V2 - R3 + V3 - GND = 0V

16 Arduino Uno Based on Atmel ATmega328P microcontroller 20 pins that can be used by various modules Three I/O ports are each controlled by three registers PORT output data, also controls pull-up resistor when an input PIN input data DDR data direction register Analog-to-Digital Converter 6 input lines, only one can be used at a time Converter clock rate controlled by a prescaler Must have a voltage reference to operate

17 Arduino Modules Know generally how the Arduino modules and external devices we've used in lab work and how they need to be programmed at a high level (Digital I/O, ADC, Interrupts, LCD) You don't need to memorize bit names or locations of each register controlling the module You should know the ideas of what some of those bits mean (i.e. what a prescalar does, what an interrupt enable bit does, how to turn on a pull-up resistor, what a DDR register indicates)

18 Bit Masking Bit masking is useful when some of the bits of a variable (e.g., a register, or a port) need to remain unchanged while modifying the rest Example: Assume B[3] needs to get flipped without affecting other bits If the current value of B is known, we may assign the updated value directly to B: Assume: B = 0x75 = 0b01110101 We may then simply reassign with the updated value, i.e., B = 0b01111101 What if we did not know the current value of the variable? B = 0bXXXXXXXX Note: X means the bit value is unknown In that case we can XOR B with a mask that exposes B[3] for a flip: B = B ^ 0b00001000 = 0bXXXXXXXX ^ 0b00001000 = 0bXXXXXXXX Note: X denotes the flipped bit (still unknown, but flipped) We may apply a shift operation to first calculate the mask: 0b00000001 << 3 which produces: 0b00001000 Therefore: B = B ^ (0b00000001 << 3) or: B = B ^ (1 << 3) B ^ = 1 << 3 or writing the short version:

19 Arduino Uno Registers can be read/written as a full byte DDRD = 0x67; y = ADCH; Reading a bit from an register x = PINB & (1 << PINB3); Writing a bit to an register; ADCSRA = (1 << ADSC); PORTC &= ~(1 << PC2); Inserting multiple bits into a register Example: write low 4 bits of x into PORTB, don t change high 4 bits in PORTB PORTB &= 0xf0; // zero out the lower 4-bits of PORTB PORTB = (x & 0x0f); // clear the upper 4-bits of x // then OR into PORTB

20 Practice Write code to do the following tasks: Turn on the top 4 bits of PORTB w/o affecting the lower 4 bits Wait until the lower 2 bits of PIND are both 1 at the same time then continue in the program Clear the LSB of DDRC Copy all the bits of PORTB into PORTD

21 Practice Assume is an 8-bit variable. Set A[5] to 1, A[3] to 0, and flip A[6] without affecting the remaining bits of A.

22 Binary Arithmetic Add column by column from right to left Subtraction converts to addition: A + ~B + 1 Check if unsigned and signed overflow occurs 11100111 + 10001101 01010011-11001001