Advertisement
SR71BlackBird

Quiz Çalışma 1 P1 interrupt

May 4th, 2012
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include  "msp430g2231.h"
  2. ;-------------------------------------------------------------------------------
  3.             ORG     0F800h                  ; Program Reset
  4. ;-------------------------------------------------------------------------------
  5. RESET       mov.w   #0280h,SP               ; Initialize stackpointer
  6. StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
  7.  
  8. SetupPx     bis.b   #01h,&P1DIR            ; P1.0 output
  9.             bic.b   #01h,&P1OUT            ; P1.0 output
  10.            
  11.             bis.b   #018h,&P1IE             ; P1.4 Interrupt enabled
  12.             bis.b   #018h,&P1IES            ; P1.4 hi/low edge
  13.             bic.b   #018h,&P1IFG            ; P1.4 IFG Cleared
  14.  
  15.                                             ;
  16. Mainloop    bis.w   #LPM4+GIE,SR            ; LPM4, enable interrupts
  17.             nop                             ; Required only for debugger
  18.            
  19. tgl         xor.b   #01h,&P1OUT
  20. wait        mov     #5000h,R4
  21. dd          dec     R4
  22.             jnz     dd
  23.             jmp     tgl
  24.                                            
  25. P1_ISR      and.b   #010h,&P1IFG
  26.             jnz     off
  27.             bic.w   #LPM4,0(SP)
  28.             reti
  29. off         bic.b   #010h,&P1IFG           ; P1.4 IFG Cleared
  30.             bic.b   #01h,&P1OUT            ; P1.0 output
  31.             mov.w   #Mainloop,2(SP)
  32.             reti                            ; Return from ISR
  33.  
  34.  
  35.  
  36.             ORG     0FFFEh                  ; MSP430 RESET Vector
  37.             DW      RESET                   ;
  38.             ORG     0FFE4h                  ; P1.x Vector
  39.             DW      P1_ISR                  ;
  40.             END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement