HERE I AM USING NAKEN430ASM COMPILER AND MSP430G2231 CONTROLLER
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 output on the corresponding I/O pin
loop:
jmp loop ;runs 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
digital input using the P1.3 (pull down resistor required)
.include “msp430g2x31.inc”
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR.B P1OUT
CLR R5
mov.b #0x41, &P1DIR
L1: MOV.b &P1IN, r5
AND.b #0x8,r5
tst r5
JZ L1
mov.b #0x41, &P1OUT
L3: jmp L3
org 0xfffe
dw 0xf800
Please see more @
http://jimmyjosep.blogspot.in/2013/12/msp430-assembly-language-part-1.html
digital input using the P1.3 (pull down resistor required)
.include “msp430g2x31.inc”
org 0xf800
mov.w #(WDTPW|WDTHOLD), &WDTCTL
CLR.B P1OUT
CLR R5
mov.b #0x41, &P1DIR
L1: MOV.b &P1IN, r5
AND.b #0x8,r5
tst r5
JZ L1
mov.b #0x41, &P1OUT
L3: jmp L3
org 0xfffe
dw 0xf800
Please see more @
http://jimmyjosep.blogspot.in/2013/12/msp430-assembly-language-part-1.html