TO TURN ON THE 2 LED (P1.0 & P1.6)
.include "msp430g2x31.inc"
org 0xf800 ;SETS THE ADDRESS OF program to
;be stored
mov.w #(WDTPW|WDTHOLD),&WDTCTL ;DISABLES WATCH DOG TIMER
mov.b #0x41, &P1DIR ;selects the direction of
;the I/O pins
mov.b #0x41, &P1OUT ;Writes logic high value to P1.0 ;& P1.6
loop:
jmp loop ;Starts the program into infinity ;loop
org 0xfffe ;SETS THE ADDRESS OF Reset vector ;to be stored
dw 0xf800
TO BLINK LED
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR P1OUT
mov.b #0x41, &P1DIR
L1: MOV.W #0xcd40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
JMP L1
org 0xfffe
dw 0xf800
TOGGLE 2 LEDS
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR P1OUT
mov.b #0x41, &P1DIR
mov.b #0x40, &P1OUT
L1: MOV.W #0xCD40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
JMP L1
org 0xfffe
dw 0xf800
TOGGLE LEDS USING THE FUNCTION CALLING
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
mov.w #0x280, SP
CLR P1OUT
mov.b #0x41, &P1DIR
mov.b #0x40, &P1OUT
L2: call #L1
JMP L2
L1: MOV.W #0xCD40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
ret
org 0xfffe
dw 0xf800
LONG DELAY LOOP
.INCLUDE "msp430x2xx.inc"
ORG 0xf800
MOV #(WDTPW|WDTHOLD), &WDTCTL
MOV #0x280,SP
MOV.B #0x41, &P1DIR
MOV.B #0x41, &P1OUT
LOOP1:
MOV #65000,R4
MOV #65000,R5
CALL #LOOP2
JMP LOOP1
LOOP2:
DEC R4
TST R4
JNZ LOOP2
LOOP3:
DEC R5
TST R5
JNZ LOOP3
XOR.B #0x41,&P1OUT
RET
ORG 0xfffe
DW 0xF800
LED BLINKING USING BIT INSTRUCTION
.INCLUDE "msp430x2xx.inc"
ORG 0xf800
MOV #(WDTPW|WDTHOLD), &WDTCTL
MOV #0x280,SP
MOV.B #0x41, &P1DIR
MOV.B #0, &P1OUT
LOOP2:
MOV #65000,R4
CALL #LOOP1
JMP LOOP2
LOOP1:
DEC R4
BIT #0xFFFE,R4 ;SIMPLY "AND"S BETWEEN SRC & DST.
;RESULT WILL NOT AFFECT SRC & DST.
;USED FOR BIT TESTING
JNZ LOOP1
XOR.B #0x41,&P1OUT
RET
ORG 0xfffe
DW 0xF800
.include "msp430g2x31.inc"
org 0xf800 ;SETS THE ADDRESS OF program to
;be stored
mov.w #(WDTPW|WDTHOLD),&WDTCTL ;DISABLES WATCH DOG TIMER
mov.b #0x41, &P1DIR ;selects the direction of
;the I/O pins
mov.b #0x41, &P1OUT ;Writes logic high value to P1.0 ;& P1.6
loop:
jmp loop ;Starts the program into infinity ;loop
org 0xfffe ;SETS THE ADDRESS OF Reset vector ;to be stored
dw 0xf800
TO BLINK LED
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR P1OUT
mov.b #0x41, &P1DIR
L1: MOV.W #0xcd40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
JMP L1
org 0xfffe
dw 0xf800
TOGGLE 2 LEDS
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR P1OUT
mov.b #0x41, &P1DIR
mov.b #0x40, &P1OUT
L1: MOV.W #0xCD40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
JMP L1
org 0xfffe
dw 0xf800
TOGGLE LEDS USING THE FUNCTION CALLING
.include "msp430g2x31.inc"
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
mov.w #0x280, SP
CLR P1OUT
mov.b #0x41, &P1DIR
mov.b #0x40, &P1OUT
L2: call #L1
JMP L2
L1: MOV.W #0xCD40,R4
DELAY:
DEC R4
JNZ DELAY
xor.b #0x41, &P1OUT
ret
org 0xfffe
dw 0xf800
LONG DELAY LOOP
.INCLUDE "msp430x2xx.inc"
ORG 0xf800
MOV #(WDTPW|WDTHOLD), &WDTCTL
MOV #0x280,SP
MOV.B #0x41, &P1DIR
MOV.B #0x41, &P1OUT
LOOP1:
MOV #65000,R4
MOV #65000,R5
CALL #LOOP2
JMP LOOP1
LOOP2:
DEC R4
TST R4
JNZ LOOP2
LOOP3:
DEC R5
TST R5
JNZ LOOP3
XOR.B #0x41,&P1OUT
RET
ORG 0xfffe
DW 0xF800
LED BLINKING USING BIT INSTRUCTION
.INCLUDE "msp430x2xx.inc"
ORG 0xf800
MOV #(WDTPW|WDTHOLD), &WDTCTL
MOV #0x280,SP
MOV.B #0x41, &P1DIR
MOV.B #0, &P1OUT
LOOP2:
MOV #65000,R4
CALL #LOOP1
JMP LOOP2
LOOP1:
DEC R4
BIT #0xFFFE,R4 ;SIMPLY "AND"S BETWEEN SRC & DST.
;RESULT WILL NOT AFFECT SRC & DST.
;USED FOR BIT TESTING
JNZ LOOP1
XOR.B #0x41,&P1OUT
RET
ORG 0xfffe
DW 0xF800