Search This Blog

Wednesday, January 2, 2013

;Q.3 Write a Program to increament value of memory location by 1 every 200us. Clock frquency is 500MHz


data segment
     number dw 05h ; input number
ends

code segment
start:
    ; set data segment register
    mov ax, data
    mov ds, ax                        

    mov ax,number     ; init AX
back:                 ; for every 200us
    mov bx,47     ;move number into BX           
more_delay:    
    NOP            ; 3 clock cycle
    dec bx         ; 2 clock cycle for word reg, 3 for memory or byte reg
    jnz more_delay ; 16 clock cycle/4 clock cycle
    inc number     ; 2 clock cycle
    jmp back       ; 15 clock cycle
    mov ax, 4c00h  ; exit to operating system.
    int 21h        ; 21 is DOS interrupt ......... value is ax determines operation
ends

end start ; set entry point and stop the assembler.
      

;
;time of one clock = 1/(500) us
;                  = 0.2 us
;total clocks required(CT) = 200/0.2 =1000
;CT = n*(3+2+16)+17 = 1000
;n = (1000-17)/(21) = 47


1 comment: