Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

1. To exercise the logical operations, write a program that works with three one-byte data variables labeled

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.

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

Step: 1

c include int main unsigned char STATUS 0xC1 unsigned char CONTROL 0xA8 unsigned char PERIPH 0xD2 if ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Elementary Linear Algebra with Applications

Authors: Howard Anton, Chris Rorres

9th edition

471669598, 978-0471669593

More Books

Students also viewed these Programming questions