### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# MicroprocessorSystems CPEG222

UD

GPA 3.97

### View Full Document

## 24

## 0

## Popular in Course

## Popular in Computer Engineering

This 12 page Class Notes was uploaded by Ms. Rosamond Fritsch on Saturday September 19, 2015. The Class Notes belongs to CPEG222 at University of Delaware taught by Staff in Fall. Since its upload, it has received 24 views. For similar materials see /class/207109/cpeg222-university-of-delaware in Computer Engineering at University of Delaware.

## Reviews for MicroprocessorSystems

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/19/15

CPEG 222 MICROPROCESSOR BASED SYSTEMS Name Spring 2006 Jorge Andres Garcia Midterm 1 1 30pts20min Analyzing and fixing a piece of code i 8pts5min Write lines 11 12 and 13 of the following subroutine code ii 8pts6min Comment the code Only sensible comments are welcome Notes INCTIMES is a variable that contains a number between 0 and 9 IN1TARRAY is the 16bit initial address of an array of constant values LINE LA BEL INS 77 UC HON COMMENT isubroutine begins 1 labell pshh 2 pshx 3 ldhx INIT ARRAY 4 lda INC TIMES 5 labelZ cmp 0 7 6 beq done deal 7 incx 7 8 deca 9 bra labelZ 10 done deal lda X 11 7 12 13 isubroutine ends iii 5pts3min In your own words different from commenting the lines of code tell me what it does iv 6pts5min Suppose the memory contents shown below If at the beginning of the subroutine INITARRAY 182D and INCTIMES 3 what is the value stored in register A at the end of the subroutine What if INCTIMES 0 Address ValueHeX 182C 182D E0 182E 52 182F 1F 1830 37 1831 2E v 3pts1min What type of addressing mode is being used in line 10 2 20pts20min Checking concepts i 4pts4min Give assembly examples of four addressing modes 1 2 3 4 ii 4pts4min Assume you have 10 memory positions 1 byte each available in your memory to create a lookup table of numbers that are powers of two 2 4 8 16 etc Which one is the last one iii 2pts2min If you have an 8bit microcontroller how many memory locations are necessary to create a lookup table containing these numbers 122 238 754 1290 iv 2pts2min What if it were a 16bit microcontroller v 2pts2min Why the initialization of the stack pointer is one of the first things done in a program vi 2pts2min What is not saved in the stack automatically by the microcontroller when executing an interrupt subroutine vii 2pts2min What instruction must never be used to call a subroutine Why viii 2pts2min What instruction must never be used to end an interrupt service subroutine Why 3 20pts10min Flow diagrams Design the flow diagram that implements the following problem Prompt for an input character from a user at the keyboard If the character is alphabetic and is upper case change it to lower case and output it to the screen If the character is alphabetic and is lower case change it to upper case and output it to the screen If the character is numeric output it with no change If it is any other character beep the bell Repeat this process until an ESC character is typed by the user 4 30pts20min Design In many cars the seat belt alarm buzzer is also used to warn against leaving the key in the ignition or leaving the lights on This is how such a system may operate The alarm is to sound if the key is in the ignition when the door is open and the motor is not running or if the lights are on when the key is not in the ignition or if the driver belt is not fastened when the motor is running or if the passenger seat is occupied and the passenger belt is not fastened when the motor is running i 5pts3min Assuming there are sensors that produce digital signals out of the sensed variables of the car describe the resources needed from your microcontroller eg I need 1 port configured as input for this 1 port configured as output for that etc ii 5pts3min Sketch a block diagram of the system clearly labeling the parts and indicating the direction of signals flow iii 10pts7min Sketch a flow diagram of your software solution iv 10pts7min Suppose that in addition to the buzzer you want to warn the user by blinking an LED in the dashboard The LED should blink every 1 sec If you use one bit of a PORT say PORTD bit 0 to turn ON and OFF the LED write the piece of assembly code no longer than 25 lines that accomplishes the LED task assume you have a subroutine that kills time for one tenth of a second TENTHSEC EXTRA CREDIT WILL BE GIVEN TO THE SHORTEST FUNCTIONAL PIECE OF CODE SCHEMATIC DIAGRAM RU LES Schematics must show all the details of your circuit If any information is missing the design can not be produced Rules for drawing circuit diagrams 0 Rule 0 is the most important Circuit diagrams must be created before you attempt to build your design and you must have an up to date copy with you during assembly debugging and testing A 10 grade reduction penalty will be assessed for each violation of this rule 1 Draw with a pencil unless you use a CAD program 2 Neatness is important We must be able to read the details 3 Represent each component with a simple symbol eg a rectangle for an IC that includes the pins and pin numbers 4 Label each connection wire with a unique name 5 Use a dot at the intersection of connecting wires 6 Do NOT draw a loop or bridge when unconnected wires cross 7 Label each component with a unique name eg U37 C14 R23 The first letter of the name should indicate the type of component eg R for resistor C for capacitor L for inductor and so on The ICs are often specified by U but this is not a hard rule 8 Place above each component or group of components a functional description eg above a group of decoder ICs would be Address Decoders above a group of 7 segment LEDs would be Output Display 9 Label each component with its part number eg 74LS38 MC68HC11 For resistors and capacitors simply specify their value and the units 10 Put pin LABELS on the inside of each chip block but put pin NUMBERS on the outside of the chip blocks 11 Include your name and the date CPEGZO Add nal Example Problems for Chapter1 Conversions between numbersystems Tvm mmhudsquuhmlme1hudllanu Seeuun1 3anupu1ynuma1 menuuavtanu Semen 1 2 Quuuem meunuu 1mmlves m1eu1auuns1n base er ungml number 1e be cunvmed and sums useru1 fur eunveung 1mm base 1111a anuLhEr base 1n quuhenl manual but mteger and hmunal cumpunml are alcualted sepamtely 1n pulynum meme eu1auuns are 1n base unne nal number su useru1 fur cunva ung mm anuLhEr base as base Example 1 Convert 1101 from binary to decimal and ternary 11n1 1x1nfn1x1nfnnx1nfn1x1nfn Nutes The subsmpl mans new 15 abmary nurrber r m1 am wecunvm 111mm ueema1wben gves 1nm 2my semebase 1n equlvalmns e 13 m Fur lazer base 3 W111 be dumg pnmanly ternary mam We need 1e cumm 111mm base three when gves 1nm beeumes 1 1111m 1 e 1 m Sn me eunvesmn mm xl f lxl fn xl fnlxl fn fle u 1 Wenuwneedlu 2M2 Smeemu1up1yby mensaddmghenumbermce 20mlethatm uplymgbythreemansaddmgthsnumber I 1 mmluukmgalcuunungthebase39hreenwn x 2 bersweg Tugen 1M2 wemnuuunemnupbmuunmgem 2 2 m gtlt22 1x11 nx2 1x1m 11u1 111 Example 2 Convert 43decimal to binary Divide the number in column 2 by that in column 1 put remainder in column 3 Number to result of 432 Remainder of 432 Most significant bit Answer is 101011 Example 3 Convert 213 decimal to hexadecimal 213 10 16 1310 510 Remainder of2l3l6 16 010 1310 D06 39 J of 1316 13 converted to hexadecimal Answer is D505 Example 4 Convert 79634 decimal to octal The integer and fractional components are determined separately Remainder of 79 8 Answer for integer 1178 The for the fractional component the fractional part is multiplied by the base and the integer component is kept Keep going until desired accuracy 39 Answer is 0504467 0634 x 8 5072 5 0072 x 8 0576 0 0576 x 8 4608 4 0608 x 8 4864 4 0864 x 8 6912 6 v 0912 x 8 7296 7 Total answer is 1175044673 Example 5 Convert 06875 decimal to binary 06875 X 2 1375 1 W1 0375 X 2 075 0 075 X 2 15 1 05 X 2 10 1 0 X 2 0 0 Multiplication and Division 0 For decimal you have memorized the multiplication times tables In other bases you need to regenerate these by addition in order to do the multiplication and division problems In every base 1 times a number is that number and 0 times a number is 0 Example 6 Multiplication of 1011 x 101 both base 2 1011 X101 1011 0000 1011 110111 Example 7 Multiplication of 2102 x 102 both base 3 Need multiplication times table for base 3 at least those portions required by the problem which is 1X22and2gtlt2ll 2102 X 102 11211 0000 2102 222111 Example 8 Multiplication of 13 x 6 both base 8 We again to generate the multiplication times tables required for this problem which is only 3 X 6 So 3 X 6 6 6 6 in octal so 6 6 14 from counting and 146 22 from addition where 4 6 12 The multiplication is shown in below Example 9 Division of 101001 by 11 all base 2 l l 0 l quotient l l l 0 l 0 0 l 0 l 0 01 l l 0 0 l 0 0 0 0 l 0 l l l l 0 remainder Example 10 Division of A2 by 6 all hexadecimal l B Answer 6 A 2 6 4 2 Need multiplication tables see below lx662x6Cfromcounting3x6l2fromC63x6186x624from3x6 3x6 9 x 6 36 from 6x6 3 x6 Bx6 9x6 2x6 36 C 42 Subtraction using Compliments 0 Subtraction using compliments performed by 0 Finding radix complement 10 s 2 s etc compliment by nding diminished radix complement 9 s l s compliment etc and adding 1 I Diminished Radix complement found by rst nding 0 For any base subtracting from rH 1 where r is base and n number of digits l o For binary this becomes inverting digits ie 0 gt 1 and l gt0 Add the radix complement to the other number Take radix complement of the result to nd the nal answer A simpli ed way of doing this is I If carry occurs it means number is positive and carry can be ignored to get the nal answer If no carry occurs the number is negative and to nd the nal answer you must take the radix compliment Example 11 532 146 base 10 Find 10 s complement 00 rquot11031999 9 6 8 5 3 9 s compliment I 4 10 s compliment Do the addition of the number the radix compliment OOOUIUJ CONbk 3 8 6 Answer Note that if there is a carry just ignoring the carry gives us the correct answer Example 12 146 532 base 10 Find 10 s complement 9 9 5 3 9 rquot11031999 2 4 6 7 9 s compliment I 8 4 6 10 s compliment Do the addition 1 4 6 4 6 8 6 1 4 No carry no number is negative So we need to take 1000 7 614 which is just the 10 s complement of 614 so we nd the reduced radix compliment 9 s compliment and add 1 9 r 1 103 1999 6 1 4 3 8 5 9 s compliment 1 6 3 8 10 s compliment Answer is 386 Example 13 1101001 1010111 binary Find 2 s complement 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 s compliment 1 0 1 0 1 0 0 1 2 s compliment Note that this is equivalent to changing 0 s to 1 s and vice versa expect for the last digit 1 1 0 1 1 0 0 1 0 0 Ignore carry so the answer which is positive is 0010010 Answer ignoring carry

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "I made $350 in just two days after posting my first study guide."

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.