Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Tiva TM 4 C 1 2 9 4 #include #include #include inc / hw _ gpio.h #include inc / hw _ ints.h #include
Tiva TMC
#include
#include
#include "inchwgpio.h
#include "inchwints.h
#include "inchwmemmap.h
#include "inchwtypes.h
#include "driverlibdebugh
#include "driverlibfpuh
#include "driverlibgpioh
#include "driverlibinterrupth
#include "driverlibpinmap.h
#include "driverlibromh
#include "driverlibrommap.h
#include "driverlibsysctlh
#include "driverlibsystickh
#include "driverlibuarth
#include "utilsuartstdioh
#include "driversbuttonsh
#include
#include "driverlibtimerh
#define LEDPIN GPIOPIN
#define LEDPIN GPIOPIN
uintt guiSysClock;
bool gledBlinking true; Global variable to track LED blinking state
volatile uintt guiMode;
#ifdef DEBUG
void errorchar pcFilename uintt uiLine
#endif
void Timeruintt durationseconds
uintt delayCycles durationseconds SysCtlClockGet;
while delayCycles
GPIOPORTNDATAR LEDPIN; Toggle LED state
SysCtlDelaySysCtlClockGet; Delay for millisecond
delayCycles;
void LedBlinkingTask
If the LED is on turn it off. Turn it on if it is off.
if GPIOPORTNDATAR & LEDPIN
GPIOPORTNDATAR & ~LEDPIN; LED'i sndr
else
GPIOPORTNDATAR LEDPIN; LED'i yak
uintt guiSysClock;
volatile uintt guiMode;
#ifdef DEBUG
void
errorchar pcFilename uintt uiLine
#endif
void
SysTickIntHandlervoid
void TimerBegin
uintt Period;
Period ; saniyelik gecikme salayc
SysCtlPeripheralEnableSYSCTLPERIPHTIMER;
SysCtlDelay;
TimerConfigureTIMERBASE, TIMERCFGPERIODIC;
TimerLoadSetTIMERBASE, TIMERA Period ;
TimerIntRegisterTIMERBASE, TIMERA LedBlinkingTask;
TimerIntEnableTIMERBASE, TIMERTIMATIMEOUT;
TimerEnableTIMERBASE, TIMERA;
void ConfigureUARTvoid
MAPSysCtlPeripheralEnableSYSCTLPERIPHGPIOA;
MAPSysCtlPeripheralEnableSYSCTLPERIPHUART;
MAPGPIOPinConfigureGPIOPAURX;
MAPGPIOPinConfigureGPIOPAUTX;
MAPGPIOPinTypeUARTGPIOPORTABASE, GPIOPIN GPIOPIN;
UARTStdioConfig guiSysClock;
int mainvoid
MAPSysCtlClockFreqSetSYSCTLXTALMHZ SYSCTLOSCMAIN SYSCTLUSEPLL SYSCTLCFGVCO;
MAPSysCtlPeripheralEnableSYSCTLPERIPHGPION;
MAPSysCtlPeripheralEnableSYSCTLPERIPHGPIOJ;
MAPSysCtlPeripheralEnableSYSCTLPERIPHGPIOC;
MAPGPIOPinTypeGPIOOutputGPIOPORTNBASE, GPIOPIN GPIOPIN;
MAPGPIOPinTypeGPIOInputGPIOPORTJBASE, GPIOPIN GPIOPIN;
MAPGPIOPinTypeGPIOInputGPIOPORTCBASE, GPIOPIN GPIOPIN GPIOPIN GPIOPIN;
MAPGPIOPadConfigSetGPIOPORTJBASE, GPIOPIN GPIOPIN GPIOSTRENGTHMA GPIOPINTYPESTDWPU;
MAPGPIOPadConfigSetGPIOPORTCBASE, GPIOPIN GPIOPIN GPIOPIN GPIOPIN GPIOSTRENGTHMA GPIOPINTYPESTDWPU;
guiSysClock SysCtlClockGet;
MAPSysTickPeriodSetguiSysClock ;
MAPSysTickEnable;
MAPSysTickIntEnable;
ConfigureUART;
TimerBegin;
while
SysCtlDelay;
I just want the led to light up at second intervals by calling the TimerBegin function in the main, and the button USRSW should trigger the TimerBegin function, in summary, after clicking the button, TimerBegin will run and the led will turn on and off at second intervals.
Please don't share AI codes, they don't work
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started