Question: For problems 6 , through 1 1 , use the following beginning values of the P 1 OUT register: P 1 OUT bit 7 bit

For problems 6, through 11, use the following beginning values of the P1OUT register:
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
01001100
6. Write a line of code to set bit3 and bit 4 of the P1OUT register while leaving the other bits
unchanged, and then show the result
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
NAME: ______________________________
7. Write a line of code to reset or clear bit3 and bit 4 of the P1OUT register while leaving the
other bits unchanged, and then show the result, and show the result
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
8. Write a line of code to toggle bit3 and bit 4 of the P1OUT register while leaving the other
bits unchanged, and then show the result, and show the result
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
The following constants are defined in the include file msp430g2553.h to make bit
twiddling more intuitive:
#define BIT0(0x0001)
#define BIT1(0x0002)
#define BIT2(0x0004)
#define BIT3(0x0008)
#define BIT4(0x0010)
#define BIT5(0x0020)
#define BIT6(0x0040)
#define BIT7(0x0080)
#define BIT8(0x0100)
#define BIT9(0x0200)
#define BITA (0x0400)
#define BITB (0x0800)
#define BITC (0x1000)
#define BITD (0x2000)
#define BITE (0x4000)
#define BITF (0x8000)
NAME: ______________________________
9. Show the result of the following line of code:
P1OUT &= ~BIT6 & ~BIT7;
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
10. Show the result of the following line of code:
P1OUT |= BIT6| BIT7;
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit
0
11. Show the result of the following line of code:
P1OUT ^= BIT6| BIT7;
P1OUT
bit
7
bit
6
bit
5
bit
4
bit
3
bit
2
bit
1
bit

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!