Question: 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

 1. To exercise the logical operations, write a program that works

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 0 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 0 , from left to right, within each byte.) 2. Test the program using the following initial data values: STATUS =0C1,CONTROL=0AA,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 =03E,CONTROL=03B,PERIPH=056, 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.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!