Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21936

CCS/MSP432P401R: Completely new to coding interrupts, would like some assistance.

$
0
0

Part Number:MSP432P401R

Tool/software: Code Composer Studio

Hi, I am new to the idea of interrupts in microcontrollers.

So far, based on what I've read from user guides and reference manuals, I've figured out that I am supposed to configure the PxIES, PxIE, PxIFG, as well the the GIE bit in order to allow interrupts within the program. I have only gotten to this point and I don't know where to go from here. Could anyone please offer some insight or point me in the direction I need to go? I heard that I need to configure the NVIC? or the startup_msp432 source file that is made available when you create a project.

If it helps, I am using the MSP432P401R along with the Educational BoosterPack MKII.

And here is the code I currently have.

#include "msp.h" 		// device specific include file
#define S1 BIT1			// S1 connected to P5.1
#define S2 BIT5			// S2 connected to P3.5
#define BLUE BIT6		// Blue LED connected to P5.6

void main(void) {

	WDTCTL = WDTPW | WDTHOLD; 		// disable watchdog timer

	//enable falling edge interrupt on S1
	P5IES |= S1;
	P5IE |= S1;
	P5IFG &= ~S1;	// clear flag to ensure no pending interrupts on S1

	//enable falling edge interrupt on S2
	P3IES |= S2;
	P3IE |= S2;
	P3IFG &= ~S2;	// clear flag to ensure no pending interrupts on S2

	_enable_interrupts();	// set GIE bit to enable interrupts

}


Viewing all articles
Browse latest Browse all 21936

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>