Question: please this assignment is for code design studio to use with msp 432 launchpad. ONLY NEED STEP D E F Blink LEDs with Timer0 A
please this assignment is for code design studio to use with msp 432 launchpad.
ONLY NEED STEP D E F
Blink LEDs with Timer0
A. Follow the Getting Started document Getting_Started_CCS.pdf to create a new CCS project for the MSP432 LaunchPad. You may name the new CCS project as Lab2_1.
B. Delete the main.c file if you have generated that file automatically when you were creating your new CCS project.
C. Copy the source code file Lab2_1_main.c into your project folder.
D. Build, load, and run your project on the LaunchPad.
E. Observe the LED blinking pattern on LaunchPad. Explain the code. The references that you will need to read are listed on the page titled References in the lecture notes. You will need to develop a habit of keeping those references handy and look up information frequently from those files. What you need to explain in your report include what the code in that file does, where the function is defined, what is the definition of the function, what are the input parameters, why the parameters are given the values as in the source code.
F. Stop debugging so your CCS returns back to the CCS Edit perspective.
this is the code
#include //Exact-width integer types #include //Driver library #define DCO_FREQ48e6 //unit: Hz; DCO nominal frequencies: 1.5, 3, 6, 12, 24, 48 MHz. #define TIMER0_FREQ 1 //unit: Hz //function prototypes void initDevice(void); void initTimer(void); void initGPIO(void); //global variables uint32_t clockMCLK; void main(void) { initDevice(); initTimer(); initGPIO(); //Enable interrupts Interrupt_enableSleepOnIsrExit(); Interrupt_enableMaster(); Timer32_startTimer(TIMER32_0_BASE, false); while(1) { PCM_gotoLPM0(); } } void initDevice(void) { WDT_A_holdTimer(); //stop Watchdog timer //Change VCORE to 1 to support a frequency higher than 24MHz. //See data sheet for Flash wait-state requirement for a given frequency. PCM_setPowerState(PCM_AM_LDO_VCORE1); FlashCtl_setWaitState(FLASH_BANK0, 1); FlashCtl_setWaitState(FLASH_BANK1, 1); //Enable FPU for DCO Frequency calculation. FPU_enableModule(); FPU_enableLazyStacking(); // Required to use FPU within ISR. //Only use DCO nominal frequencies: 1.5, 3, 6, 12, 24, 48MHz CS_setDCOFrequency(DCO_FREQ); //Divider: 1, 2, 4, 8, 16, 32, 64, or 128. //SMCLK used by UART and ADC14. CS_initClockSignal(CS_MCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_1); CS_initClockSignal(CS_HSMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_8); CS_initClockSignal(CS_SMCLK, CS_DCOCLK_SELECT, CS_CLOCK_DIVIDER_16); clockMCLK = CS_getMCLK(); } void initTimer(void) { Timer32_initModule(TIMER32_0_BASE, TIMER32_PRESCALER_1, TIMER32_32BIT, TIMER32_PERIODIC_MODE); Timer32_setCount(TIMER32_0_BASE, clockMCLK/TIMER0_FREQ); Timer32_enableInterrupt(TIMER32_0_BASE); Interrupt_enableInterrupt(INT_T32_INT1); //Enable Timer32_0 interrupt in the interrupt controller. } void initGPIO(void) { //Configure P1.0 as output. //P1.0 is connected to a red LED on LaunchPad. GPIO_setAsOutputPin(GPIO_PORT_P1, GPIO_PIN0);
} //Timer32_0 ISR void T32_INT1_IRQHandler(void) { Timer32_clearInterruptFlag(TIMER32_0_BASE); GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); }