ECE2801_C08_bonus_quiz1_sol

ECE2801_C08_bonus_quiz1_sol - 2/2 = 1 R0 1/ 2 = 0 R1 So 17...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 2801 – Foundations of Embedded Systems Bonus Quiz #1 Name: ___ Solutions____                                          ECE Box #: __________ 1)  What are hh, gg, and kk equal to at the end of main() ?. int sum_sq(int a, b);  {    int c;           c = a*a;    c += b*b;    return(c); } void main() {         int   gg, hh, kk;           gg = 5;      // gg = 5, kk = 3, hh = 34          kk = 3;               hh = sum_sq(kk,gg);      } 2)  Express 17 decimal as a sixteen bit unsigned integer.      17/2 = 8 R1    Remainder is LSB 8/2 = 4  R0 4/2 = 2 R0                
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2/2 = 1 R0 1/ 2 = 0 R1 So 17 = 10001b Sixteen bit representation: 17 = 000 0000 0001 0001 b = 0011h 3) -5 decimal as a sixteen bit two's complement integer is a. 8005 h b. FFFB h c. 80FB h d. 1005 h 00000000 00000101 = +5 11111111 11111010 complement 11111111 11111011 add 1 F F F B 4) The MSP430F449 is a “Little Endian” processor. What does that mean? Multi-byte data words are stored with the least significant byte in the lower address ( low byte, high byte )....
View Full Document

This note was uploaded on 01/24/2009 for the course ECE 2801 taught by Professor Jarvis during the Spring '08 term at WPI.

Ask a homework question - tutors are online