19 Mart 2013

Mikroişlemciler Hafta 5 - BCD Toplama

Mikroişlemciler 5. Hafta Konusu Normal Toplama ve BCD Toplama.

;******************************************************************************
; BURAK AVCI 090202395 HAFTA-5
;******************************************************************************
 .cdecls C,LIST,  "msp430g2231.h"

;------------------------------------------------------------------------------
            .text                           ; Progam Start
;------------------------------------------------------------------------------
RESET       mov.w   #0280h,SP               ; Initialize stackpointer
StopWDT     mov.w   #WDTPW+WDTHOLD,&WDTCTL  ; Stop WDT
SetupP1     bis.b   #001h,&P1DIR            ; P1.0  output
                     
            ;Ilk Soru
            mov #0059h, r11
            mov r11,r12
            and #000fh, r11
            rla r12
            rla r12
            rla r12
            rla r12
            add r11,r12
            add #03030h, r12
            nop
            
            ;BCD Toplama (5 Aşamalı)
            mov #02h,r11
            mov #03h,r12
            clrc
            dadd r11,r12

            mov #08h,r11
            mov #09h,r12
            clrc
            dadd r11,r12

            mov #02h,r11
            mov #09h,r12
            clrc
            dadd r11,r12

            mov #09999h,r11
            mov #01h,r12
            clrc
            dadd r11,r12

            mov #09990h,r11
            mov #0180h,r12
            clrc
            dadd r11,r12
            

;------------------------------------------------------------------------------
;           Interrupt Vectors
;------------------------------------------------------------------------------
            .sect   ".reset"                ; MSP430 RESET Vector
            .short  RESET                   ;
            .end

Ders: Mikroişlemciler
Prof. Dr. Bekir Tevfik Akgün

Hiç yorum yok:

Yorum Gönder