Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] naken430asm some doubts

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
How to write ISR in assembly?

I just wrote it as below but not working...Could any one help me?

PHP:
.include "msp430g2x31.inc"
org 0xf800
start:
         mov #0x280,r1
         mov #23168,&WDTCTL
         mov #0xfee9, &TACTL
         mov.b #0xff,&P1DIR
         mov.b #0,&P1OUT
         eint
        mov.b #1,&P1OUT
gg:
        jmp gg

isr:
        xor.b #1,&P1OUT
        and #0xfffe,&TACTL
        reti              
        reti
org 0xfff0           ;timer_a2 vector
        dw isr
org 0xfffe           ;reset vector 
        dw 0xf800
 
Last edited:

not working means?

assembles properly and generate hex file?
how did you test the working?

eint is in c.

---------- Post added at 16:32 ---------- Previous post was at 14:49 ----------

you are making P1 as 0.
then after eint (?)
why p1 as 1?.

a very short pulse in P1?
or you want make 1 in P1 after a time delay?
if that is so , no immediate P1 as 1.
only in isr.

and why there are two reti instn in isr?
 
Yes I am getting the hex file properly,,

What I am trying to do is, just to toggle the P1.0 led in the MSP430 launchpad to toggle on every timer interrupt ...
I tried it without interrupt, by just polling the TACTL bit 0 (TAIFG) and that is working properly...That code is below...
PHP:
THE BELOW CODE IS WORKING PROPERLY

.include "msp430g2x31.inc"
org 0xf800
start:
	 mov #0x280,r1              ;set stack pointer to just above the ram (0x27e)
	 mov #23168,&WDTCTL ;disabled watchdog timer
	 mov #0xfee9, &TACTL  ;set the TIMER control register 
	 mov.b #0xff,&P1DIR     ;set port1 as output
	 mov.b #0,&P1OUT        ;set port1 as zero
loop1:
	 mov #1,r8            
	 and &TACTL,r8	 	 ; moved TACTL bit 0 to r8 for comparing
	 cmp #1,r8                  ; checking to TACTL bit 0 is set 
	 jnz loop1                   ;if TACTL bit 0 (flag) not set, then go to loop1
	 xor.b #1,&P1OUT      ;toggle the LED
	 and #0xfffe, &TACTL ;just cleared the interrupt flag
 	 jmp loop1
org 0xfffe                           
	dw 0xf800                  ; set the reset vector start


Later I tried the first code I posted, there I tried to do it in the ISR but that is not working...I doubt the way I implemented the ISR. Is it right? I mean at least the SYNTAX ? Because I guessed the line
Code:
org 0xfff0           ;timer_a2 vector
        dw isr
by seeing the below code;
Code:
org 0xfffe           ;reset vector 
        dw 0xf800

I checked the interrupt vector address of timer in data sheet and found it as 0xfff0.
Also, I could see an instruction 'enti' from the datasheet (but not a core instruction).
 
Last edited:

instead of two 'reti' , have only one 'reti' instruction. and try your first code.
 

Solved ;

I configured the TACTL incorrectly...Now I modified it as

mov.w #(TASSEL_2|MC_2|ID_3|TAIE), &TACTL

Now it is working...
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top