Question

In: Computer Science

Port = 0x0055 A) Port &= 0xff0; B) Port |= 15;   C) Port = Port ^...

Port = 0x0055

A) Port &= 0xff0;

B) Port |= 15;  

C) Port = Port ^ 0x0005;

D) Port = ( ( Port &~(0x000f) ) | 0x0020 );  

Please explain how each logical opperator works and write out the results.

Solutions

Expert Solution


Given:
Port = 0x0055
   In decimal : 85
   In Binary: 1010101

A)  
   Port &= 0xff0;
       = Port = Port & 0xff0

       0xff0 = 4080 in decimal
               = 111111110000 in Binary

       Port & 0xff0 => 1010101 & 111111110000 = 1010000 in Binary

B)
   Port |= 15;
   Port = Port | 15

   15 = 1111 in Binary

   Port | 15 =>
       1010101 | 1111 = 1011111 => 95 in decimal

C)
   Port = Port ^ 0x0005;

   0x0005 => 5 in decimal => 101 in binary

   Port ^ 0x0005 = 1010101 ^ 101 => 1010000 => 80 in decimal

D)
   Port = ( ( Port &~(0x000f) ) | 0x0020 );

   0x000f = 15 in decimal = 1111 in binary
   ~(0x000f) = -16 in decimal = 11111111111111111111111111110000 in binary
   0x0020 = 32 in decimal = 100000 in binary

   ( Port &~(0x000f) => 1010101 & 11111111111111111111111111110000 = 80 in decimal = 1010000 in binary
   ( Port &~(0x000f) | 0x0020 => 1010000 | 100000 => 1110000 = 112 in decimal


Related Solutions

Write the C code required to configure pin 0 on port B to be an input...
Write the C code required to configure pin 0 on port B to be an input with the pullup resistor enabled.
b. Who is a ‘port technician’?
b. Who is a ‘port technician’?
1.  Suppose c = 15 and A = 35 degrees. Find: a= b= B= 2. Suppose a...
1.  Suppose c = 15 and A = 35 degrees. Find: a= b= B= 2. Suppose a = 12 and b = 11. Find an exact value or give at least two decimal places: sin(A)= cos(A) = tan(A) = sec(A)= csc(A)= cot(A)=
Write instruction(s) in C to get bits 4 and 7 of Port-C, then compute the “XOR...
Write instruction(s) in C to get bits 4 and 7 of Port-C, then compute the “XOR (exclusive OR)” of these two bits and write the result of the “XOR operation” to bit 4 of Port-D.
Bond Coupon Rate ​(annual payments) Maturity ​(years) A 0.0​% 15 B 0.0​% 10 C 3.9​% 15...
Bond Coupon Rate ​(annual payments) Maturity ​(years) A 0.0​% 15 B 0.0​% 10 C 3.9​% 15 D 7.6​% 10 What is the percentage change in the price of each bond if its yield to maturity falls from 6.1% to 5.1%​? The price of bond A at 6.1% YTM per $100 face value is $ (round to nearest cent) ​
There are A, B and C, three plastic balls, A and B, B and C, C...
There are A, B and C, three plastic balls, A and B, B and C, C and A are attracted to each other, if A is positive: Group of answer choices 1. Both B and C are negatively charged. 2. One of the B balls and the C balls is going to be negatively charged and the other one is not charged 3. B ball, C ball has no charge 4. B ball is negatively charged, C ball is positively...
(6ptseach)Let A={a,b,c},B={b,c,d},C ={b,c,e}. (a) Explicitly find (i) A∪(B∩C), (ii)(A∪B)∩C, and (iii)(A∪B)∩(A∪C). (iv)Which of these sets are...
(6ptseach)Let A={a,b,c},B={b,c,d},C ={b,c,e}. (a) Explicitly find (i) A∪(B∩C), (ii)(A∪B)∩C, and (iii)(A∪B)∩(A∪C). (iv)Which of these sets are equal? (b) Explicitly find (i) A∩(B∪C), (ii)(A∩B)∪C, and (iii)(A∩B)∪(A∩C). (iv)Which of these sets are equal? (c) Explicitly find (i)(A−B)−C and (ii) A−(B−C). (iii)Are these sets equal?
Chapter 15 1) The name of HClO is ________. a. hydrogen chloride b. hydrochloric acid c....
Chapter 15 1) The name of HClO is ________. a. hydrogen chloride b. hydrochloric acid c. chloric acid d. perchloric acid e. hypochlorous acid 2) Identify the Bronsted-Lowry acid in the following reaction. H2O + CO3 2- (aq) ? HCO3 - (aq) + OH- (aq) a. H2O b. CO3 2- c. HCO3 - d. OHe. H2CO3 3) What is the [H3O+] in a solution with [OH- ] = 1.0 � 10-12 M? a. 1.0 � 10-12 M b. 1.0 �...
Question 1 a) Determine the specific enthalpy of steam at 15 bar and 275°C . b)...
Question 1 a) Determine the specific enthalpy of steam at 15 bar and 275°C . b) Determine the degree of superheat and entropy of steam at 10 bar and 380 °C. c) A superheated steam at 12.5 MN/m2 is at 650°C .Determine its specific volume. Question 2 A superheated steam at 24 bar and 500 °C expands at constant volume until the pressure becomes 6 bar and the dryness fraction is 0.9. Calculate the changes in the internal energy of...
We observe three well-diversified portfolios A, B and C with a return of 15%, 6%, and...
We observe three well-diversified portfolios A, B and C with a return of 15%, 6%, and 12% respectively in the market. We also know that portfolio A, B and C has a beta of 1.5, 0.5, and 1.0 respectively. Construct an arbitrage strategy, and how much is the arbitrage profit?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT