Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It would be greatly appreciated if you could explain how this works im not reall

ID: 3754820 • Letter: I

Question

It would be greatly appreciated if you could explain how this works im not really understanding what any of this means.

1) Fill in the mask and operation to perform the masking operation called for (8 points)

a) Force bit 3 high

PORTB __= ___________;

b) Force bit 1 low

PORTB __= ___________;

c) Force bit 5 high

PORTB __= ___________;

d) Toggle bit 6

PORTB __= ___________;

2) For what values of the integer k, will the function "Test" execute? (7)

a)

if( k )

{

// Will execute if k ______________________

Test();

}

b)

if( k > 5 && k < 10)

{

// Will execute if k ______________________

Test();

}

c)

if( k & 0x0020)

{

// Will execute if bit ____ in k is a ____

Test();

}

Explanation / Answer

1) Fill in the mask and operation to perform the masking operation called for (8 points)

a) Force bit 3 high

PORTB __= ___(1 << 3) | PORTB)________;

b) Force bit 1 low

PORTB = ~(1 << 1) & PORTB);

c) Force bit 5 high

PORTB __= (1 << 5) | PORTB)________;;

d) Toggle bit 6

PORTB = (1 << 6) ^ PORTB;

2) For what values of the integer k, will the function "Test" execute? (7)

a)

if( k )

{

// Will execute if k _____is NOT ZERO_________________

Test();

}

b)

if( k > 5 && k < 10)

{

// Will execute if k _____IS 6, 7,8,9_________________

Test();

}

c) 0000 0000 0010 0000

if( k & 0x0020)

{

// Will execute if bit _5___ in k is a _1_ [Counting bit starts from 0]

Test();

}



Thanks, PLEASE UPVOTE if helpful

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote