# ANS1 - E C E 4 1 7 5 Q U I Z 9-2 3-0 9(1 o f 2 FIV E P R O...

This preview shows pages 1–2. Sign up to view the full content.

ECE 4175 QUIZ 9-23-09 (1 of 2) REVISED High 100 FIVE PROBLEMS Upper quarter 87 Open book, open notes Median 77 Lower quarter 56 Low 24 1. Write C code to turn on the Qwik&Low board’s LED if bit 3 of PORTB (which has already been set up as an input) is set; otherwise turn off the LED. Be sure to leave all other output pins unaffected. [10%] if (PORTBbits.RB3) { PORTDbits.RD4=1; } else { PORTDbits.RD4=0; } Andrew Matteson, Tri Pho, and Terance Wu provided a simpler alternative (that I didn’t know would work until I checked it): PORTDbits.RD4=PORTBbits.RB3; 2. board. [20%] NEW = PORTE & 0b00000010; NEW += PORTB & 0b00000100; a. The resulting value of NEW depends upon code executed before these lines. What is the function of this preceding code? It powers up the two pullup resistors driven from RE2 and RE0. b. Given the appropriate preceding code, what are the possible values of NEW , expressed as binary numbers? 0b00000000 0b00000010 0b00000110 0b00000100 3. For this problem, you are to write a Time function, called each time around the main loop. Time uses a static local unsigned char variable called TIMECNT to count the 100 loop times making up one [40%] second. It also uses another static local unsigned char variable called

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/08/2011 for the course ECE 4175 taught by Professor Peatman during the Fall '08 term at Georgia Tech.

### Page1 / 2

ANS1 - E C E 4 1 7 5 Q U I Z 9-2 3-0 9(1 o f 2 FIV E P R O...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online