Professional Documents
Culture Documents
kdata
temp1: .word 0 # set temp to 0
temp2: .word 0
temp3: .word 0
.ktext 0x80000080
sw $a0,temp1
# save
mfc0 $a0, $13 # send
andi $a0, $a0, 0x003c
srl $a0, $a0, 2
bne $a0, $0, L1 #check
e is 0. If it is not then send
a0 to temp1
refgister 13 to a0
# mask unwanted bits
# shift two bits to right to find ex.no
if external interrupt. It is external if the valu
to L1
.data
count_pr: .word
count_read: .word
pulse_width .word
0xffffffff
0x00000000
0
.text
.globl main
main:
la $t0, count_pr #load address of count_pr
lw $t1, 0($t0) #load value of count_pr
beq $t1, $0, main # if count_pr value is 0, so its counting, the
n loop back to main as the count_read is not readable yet.
# if the counter has stopped now then get the count read value
la $t0, count_read #load address of count_read
lw $t2, 0($t0) #load value of count_read
# now divide the count_read value by 10
addi $t3, $0, 10
div $t2, $t3 # divide count_read by 10. Stored quotient in LO. u
se mflo
mflo pulse_width