Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Many Thanks and Thumps up in advance Objective Investigate the usage of bitwise and shift operators using the C language Procedure 1. Create a new

Many Thanks and Thumps up in advanceimage text in transcribed

Objective Investigate the usage of bitwise and shift operators using the C language Procedure 1. Create a new C project in Code Composer. Initialize the contents of three local variables of type int as follows volatile int i = 0x25A3; volatile int j = 0x8B94; volatile int k 0x006C; Perform the following operations using the appropriate C operators. Create a new variable r to store the result. Use the watch window in CCS to observe the results (change the Number Format to Binary). For each operation, record the result in binary Description C Language Predicted Result MSP430 Result Bitwise AND r-i &j Bitwise OR Bitwise XOR Bitwise NOT on i 2. Masking. Perform a "bit test" operation to test if the bit5 of the variable i is a one. Hint: create a new variable with a mask. Remember the LSB = bit. If the result of the test is stored in an int, can you use the result of the test in a conditional loop (which requires a Boolean value in the condition)? Explain. In this exercise, you used the data type int. This variable can represent both negative and positive integer values. If you change the data type to unsigned int 3. a. Does t change the decimal value of the result? Explain. b. Does t change the bit values of the result? Explain. Hint: experiment with the Number Format...Default, Decimal, and Hex 4. What does the following expression do? Hint: rewrite it as separate expressions. Objective Investigate the usage of bitwise and shift operators using the C language Procedure 1. Create a new C project in Code Composer. Initialize the contents of three local variables of type int as follows volatile int i = 0x25A3; volatile int j = 0x8B94; volatile int k 0x006C; Perform the following operations using the appropriate C operators. Create a new variable r to store the result. Use the watch window in CCS to observe the results (change the Number Format to Binary). For each operation, record the result in binary Description C Language Predicted Result MSP430 Result Bitwise AND r-i &j Bitwise OR Bitwise XOR Bitwise NOT on i 2. Masking. Perform a "bit test" operation to test if the bit5 of the variable i is a one. Hint: create a new variable with a mask. Remember the LSB = bit. If the result of the test is stored in an int, can you use the result of the test in a conditional loop (which requires a Boolean value in the condition)? Explain. In this exercise, you used the data type int. This variable can represent both negative and positive integer values. If you change the data type to unsigned int 3. a. Does t change the decimal value of the result? Explain. b. Does t change the bit values of the result? Explain. Hint: experiment with the Number Format...Default, Decimal, and Hex 4. What does the following expression do? Hint: rewrite it as separate expressions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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_2

Step: 3

blur-text-image_3

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

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

Describe your ideal working day.

Answered: 1 week ago