Fill in the mask and operation to perform the masking operat
Fill in the mask and operation to perform the masking operation called for
a) Force bit 3 high PORTB __= ___________;
b) Force bit 1 low PORTB __= ___________;
c) Force bit 5 high PORTB __= ___________;
d) Toggle bit 6 PORTB __= ___________;
For what values of the integer k, will the function \"Test\" execute?
e) if( k ) { // Will execute if k ______________________ Test(); }
f) if( k > 5 && k < 10) { // Will execute if k ______________________ Test(); }
g) if( k & 0x0020) { // Will execute if bit ____ in k is a ____ Test();
Solution
Assumption is bit counting starts from 0 (LSB)
a) Force bit 3 high PORTB __= ___________; PORTB |= 1<<3
b) Force bit 1 low PORTB __= ___________; PORTB &= ~(1 << 1);
c) Force bit 5 high PORTB __= ___________; PORTB |= 1<<5
d) Toggle bit 6 PORTB __= ___________; PORTB ^= 1 << 6;
For what values of the integer k, will the function \"Test\" execute?
e) if( k ) { // Will execute if k _____is not equal to 0_________________ Test(); }
f) if( k > 5 && k < 10) { // Will execute if k _____if k is greater than 5 and less than 10_______ Test(); }
g) if( k & 0x0020) { // Will execute if bit __5__ in k is a _high___ Test();
