I have a project due soon, and I am having trouble with it. Here is my code:
`
#include "msp430.h" ; #define controlled include file
NAME main ; module name
PUBLIC main ; make the main label vissible
; outside this module
ORG 0FFFEh
DC16 init ; set reset vector to 'init' label
RSEG CSTACK ; pre-declaration of segment
RSEG CODE ; place program in 'CODE' segment
init: MOV #SFE(CSTACK), SP ; set up stack
main: NOP ; main program
MOV.W #WDTPW+WDTHOLD,&WDTCTL ; Stop watchdog timer
bis.b #00000001b, &P1DIR ; P1DIR 1.0 output direction
bic.b #00001000b, &P1DIR ; P1DIR 1.3 = 0, input direction
bic.b #00000001b, &P1OUT ; P1OUT = 0, LED off
bis.b #00001000b, &P1IE ; P1IE.3 = 1, enable interrupt on
;Port 1, push button
bic.b #00001000b, &P1IFG ;P1IFG.3 = 0, clear push button
;interrupt
bis.b #00001000b, &P1REN ;
bis.w #CPUOFF+GIE, SR ; CPU off, interrupts enabled
PORT1: cmp.b #00001000b, &P1IFG ;
JEQ TOGGLE_LED
TOGGLE_LED:
bic.b #00001000b, &P1IFG ; P1IFG.3 = 0, clear push button interrupt
xor.b #00000001b, &P1OUT ; P1OUT.6 toggle LED
reti ;
COMMON INTVEC ; Interrupt Vectors
ORG PORT1_VECTOR ; PORT1 Vector
DW PORT1 ;
JMP $ ; jump to current location '$'
; (endless loop)
END
I am reusing code that I made for our last lab, and with this, when I press the P1.3 button on the launchpad, the red LED will toggle on and off. What I need to do now is fugure out how to use this code to toggle an external LED on a breadboard. I have the wires, and the school breadboards have their own power supply (with GND and 5v). Any help would be appreciated.