1. To exercise the logical operations, write a program that works with three one-byte data variables...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. To exercise the logical operations, write a program that works with three one-byte data variables labeled STATUS, CONTROL and PERIPH. The program is to perform the following operations. If bit 4 of STATUS is 0, set bit 3 of CONTROL to 0, otherwise set bit 2 of CONTROL to 1. If bit 2 of STATUS is O and bit 1 of STATUS is 0, set bit 6 of CONTROL to 1, otherwise set bit 5 of CONTROL to 0. Replace bits 6-3 of PERIPH with the hex digit 5, without changing the other four bits of PERIPH. Data are stored in "little endian" format (bits are numbered 7 down to O, from left to right, within each byte.) 2. Test the program using the following initial data values: STATUS = 0xC1, CONTROL = 0xA8, PERIPH = 0xD2. Display these values in the Expressions view and in a Memory view (rendered in hexadecimal, to facilitate examining bytes), and capture the Expressions view to show the final values of STATUS, CONTROL, and PERIPH. Then reset the program, change the data to STATUS=0x3E, CONTROL=0x3B, PERIPH=0x56, run the program, and again capture the Expressions view to show the final values of STATUS, CONTROL and PERIPH. Note that you can change the data, while the program is paused at label main, by either clicking on a value in the Memory view and enter a new value, or entering GDB "set" commands to change values. (Refer to section F of the Tutorial.) 3. Submit the source code and the Expressions views, circling or highlighting the values of the three variables in the Expressions view after each run. 1. To exercise the logical operations, write a program that works with three one-byte data variables labeled STATUS, CONTROL and PERIPH. The program is to perform the following operations. If bit 4 of STATUS is 0, set bit 3 of CONTROL to 0, otherwise set bit 2 of CONTROL to 1. If bit 2 of STATUS is O and bit 1 of STATUS is 0, set bit 6 of CONTROL to 1, otherwise set bit 5 of CONTROL to 0. Replace bits 6-3 of PERIPH with the hex digit 5, without changing the other four bits of PERIPH. Data are stored in "little endian" format (bits are numbered 7 down to O, from left to right, within each byte.) 2. Test the program using the following initial data values: STATUS = 0xC1, CONTROL = 0xA8, PERIPH = 0xD2. Display these values in the Expressions view and in a Memory view (rendered in hexadecimal, to facilitate examining bytes), and capture the Expressions view to show the final values of STATUS, CONTROL, and PERIPH. Then reset the program, change the data to STATUS=0x3E, CONTROL=0x3B, PERIPH=0x56, run the program, and again capture the Expressions view to show the final values of STATUS, CONTROL and PERIPH. Note that you can change the data, while the program is paused at label main, by either clicking on a value in the Memory view and enter a new value, or entering GDB "set" commands to change values. (Refer to section F of the Tutorial.) 3. Submit the source code and the Expressions views, circling or highlighting the values of the three variables in the Expressions view after each run.
Expert Answer:
Answer rating: 100% (QA)
c include int main unsigned char STATUS 0xC1 unsigned char CONTROL 0xA8 unsigned char PERIPH 0xD2 if ... View the full answer
Related Book For
Elementary Linear Algebra with Applications
ISBN: 978-0471669593
9th edition
Authors: Howard Anton, Chris Rorres
Posted Date:
Students also viewed these programming questions
-
Unbounded Knapsack Problem is a modified version of "0/1Knapsack Problem", where multiple instances of the same item can be selected. (10 Points) a) Modify the rules of Dynamic programming for...
-
Jack owns an initial wealth (W0) of $30. Inadvertently, he agreed to enter into the following game : - With 1/4 probability his wealth goes up to $50 - With 1/2 probability his wealth stays the same...
-
Compute the given derivatives with the help of formulas (1)(4). (a) (b) d dx (1) - x=e
-
An I/O-bound program is one that, if run alone, would spend more time waiting for I/O than using the processor. A processor-bound program is the opposite. Suppose a short-term scheduling algorithm...
-
A quantity of 25.0mL of a solution containing both Fe2+ and Fe3+ ions is titrated with 23.0mL of 0.0200 M KMnO4 (in dilute sulfuric acid). As a result, all of the Fe2+ ions are oxidized to Fe3+ ions....
-
Balance of a customer rotor calls for a balance tolerance of G 0.4. What does the G stand for, and what is the significance of the 0.4 level?
-
On January 1, 2006, the Vallahara Company purchased machinery for $650,000 which it installed in a rented factory. It is depreciating the machinery over 12 years by the straight-line method to a...
-
Fanshawe college Course Code : MGMT 6147 : Trends in Management & Leadership Module & Case: #10: Motivated reasoning, leadership, and team performance. 1) Please provide a brief summary of the case....
-
Complete the flexible budget variance analysis by filling in the blanks in the partial flexible budget performance report for 9,000 travel locks for Grant, Inc. GRANT, INC. Flexible Budget...
-
DRAW the npda and show the complete figure. Construct npda's that accept the following regular languages. ** (a) L = L (aaa* bab). (b) L2 L= L (aab*aba*).
-
Effective claims denial management includes the following: a. identification, management, monitoring, and prevention. b. identification, monitoring, follow-up, and prevention. c. identification,...
-
Can roles be viewed as dynamic and context-dependent constructs, evolving over time and across different social contexts, or are they primarily static and predetermined by social structures ?
-
How does the 360-degree feedback method address the court's six stress issues depicted in Gerhart and Newman's reading? Since the Brito case, there has been growing evidence that the courts have very...
-
CRM refers to the effective use of all available resources: human, hardware, and information. Other groups routinely working with the cockpit crew, who are involved in decisions required to operate a...
-
following 10words are taken from Brent Staples' essay "Why Race Isn't as "Black" and "White"as We Think." ridiculed surveyor Emancipation slave genetic screening ancestry arbitrary swarming snickered...
-
A block of mass 2kg is at rest on a horizontal rough surface (1=0.5) A horizontal force F= 5t is applied on the black at t=0. What is speed after 4 sec.
-
For each of the following transactions, indicate whether it increases, decreases, or has no effect on the following financial ratios: current ratio, debt-to-equity ratio, profit margin ratio, and...
-
What do the lines r = r0 + tv and r = r0 - tv have in common? Explain.
-
Follow the directions of Exercise 18. (a) T: R3 R3 is the reflection about the yz-plane. (b) T: R3 R3 is the orthogonal projection on the xz-plane. (c) T: R3 R3 is the dilation by a factor of 2....
-
Verify Theorem 1.7.1 d for the matrices A and B in Exercise 12. Theorem 1.7.1 d The inverse of an invertible lower triangular matrix is lower triangular, and the inverse of an invertible upper...
-
What are the various forms of virtual communication used in modern organizations?
-
What are the types of interpersonal communication?
-
How does one choose between communication methods and handle barriers to effective communication?
Study smarter with the SolutionInn App