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

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

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...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online