Question: 1a) Complete the code fragment below to enable analog function on pins PE0 and PE3 using friendly software (reference: Table R.1). #define GPIO_PORTE_AMSEL_R (*((volatile unsigned

1a) Complete the code fragment below to enable analog function on pins PE0 and PE3 using friendly software (reference: Table R.1).

#define GPIO_PORTE_AMSEL_R (*((volatile unsigned long*)) ---- )

GPIO_PORTE_AMSEL_R = -------;

b)

The following program uses bit specific addressing to access Port D. If Port D has an initial value of 0x4C, what will be the value of data and the new value on Port D after the code fragment is executed?

#define PD23 (*((volatile unsigned long *) 0x40007030))

data = PD23;

PD23 = 0x04;

[References]

GPIO_PORTx_DATA_R: GPIO data register

GPIO_PORTx_DIR_R: GPIO data direction register (0: input; 1: output)

GPIO_PORTx_AFSEL_R: GPIO mode control select register. If a bit is clear, the pin is used as a GPIO and is controlled by the GPIO registers. Setting a bit in this register configures the corresponding GPIO line to be controlled by an associated peripheral.

GPIO_PORTx_PUR_R: GPIO pull-up control register (0: weak pull-up resistor disabled; 1: weak pull-up resistor enabled)

GPIO_PORTx_DEN_R: GPIO digital enable register (0: The digital functions for the corresponding pin are disabled; 1: The digital functions for the corresponding pin are enabled.)

GPIO_PORTx_CR_R: GPIO commit register (0: The corresponding GPIOAFSEL, GPIOPUR, GPIOPDR, or GPIODEN bits cannot be written; 1: The corresponding GPIOAFSEL, GPIOPUR, GPIOPDR, or GPIODEN bits can be written.)

GPIO_PORTx_AMSEL_R: GPIO analog mode select register (0: The analog function for the corresponding pin is disabled; 1: The analog function for the corresponding pin is enabled.)

Table R. 2. Address Offset used to specify individual data port bits for bit-specific addressing

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 Databases Questions!