If a pin of a GPIO port is used as digital input, explain the possible input con
ID: 3796528 • Letter: I
Question
If a pin of a GPIO port is used as digital input, explain the possible input configurations. if a pin of a GPIO port is used as digital output, explain the possible output configurations. If a pin of a GPIO port is configured as pull-push output, what is the maximum current driven by the pin? To configure GPIOB port as following: GPIOD-Pin 0:3 as digital input with pull-up input GPIOD-Pin-4:7 as digital input with pull-down input GPIOD-Pin-8:11 as digital out with open drain output GPIOD-Pin-12:15 as digital output with push-pull output Find the values for the configuration registers of the GPIOD port and fill the table below. For the configuration of the G port in problem 4, write a section of C program to complete the configuration of the GPIOD port by using the function of STM32F4xx_StdPeriph_Driver: GPIO_Initi GPIOD, & GPIO InitStructure);Explanation / Answer
1.if a pin of a gpio port is used as digital input then the possible input configuration is the value of one digital signal either 0 or 1.
2.if a pin of a gpio port is used as digital output then the possible output configuration is the value of one digital signal either 0 or 1.
3.if a pin of a gpio port is used as pull push output it can drive 4mA , for a Vcc of 5V the minimum resistor value is 5V/4mA or 1250 Ohms.
4.gpiod-moder =ox03
gpiod-otyper =ox07
gpiod-ospeedr=ox011
gpiod-pupdr =ox15
5.#include <stdio.h>
#include <wiringPi.h>
const int pwmPin = 3;
const int ledPin = 7;
const int butPin = 11;
const int pwmValue = 1;
int main(void)
{
wiringPiSetupGpio();
pinMode(pwmPin, PWM_OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(butPin, INPUT);
pullUpDnControl(butPin, PUD_UP);
printf("Blinker is running! Press CTRL+C to quit. ");
while(1)
{
if (digitalRead(butPin))
{
pwmWrite(pwmPin, pwmValue);
digitalWrite(ledPin, LOW);
}
else
{
pwmWrite(pwmPin, 1024 - pwmValue);
digitalWrite(ledPin, HIGH);
delay(75);
digitalWrite(ledPin, LOW);
delay(75);
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.