2016-05-12 53 views
-5

任何人都可以擁有這個。裝配數字實驗室模擬計算器

計算器:

使用Digital Lab Sim構建計算器。提供+-*/

  • a+
  • b-
  • c*
  • d/
  • f=

具體:

  • 當擊中一個數,它顯示在LED,只顯示2個底部的數字。例如:按1顯示屏01,然後按2顯示屏12,如果按3顯示屏23
  • 後按號碼,按+-*/
  • f=)以示出結果LED。
+0

歡迎來到StackOverflow。我們不會爲你做功課。你有什麼嘗試?請展示一些努力。 –

+0

以及我試圖顯示數字,並按下時掃描中斷。 –

回答

0
.eqv SEVENSEG_LEFT 0xFFFF0011 # Dia chi cua den led 7 doan trai. 
       # Bit 0 = doan a; # Bit 1 = doan b; ... 
       # Bit 7 = dau . 
.eqv SEVENSEG_RIGHT 0xFFFF0010 
       # Dia chi cua den led 7 doan phai 
.text 
main: 
    li $a0, 0x6 # set value for segments 
    jal SHOW_7SEG_LEFT # show 
    li $a0, 0x7F # set value for segments 
    jal SHOW_7SEG_RIGHT # show 

exit: li $v0, 10 
    syscall 

endmain: 
#--------------------------------------------------------------- 
# Function SHOW_7SEG_LEFT : turn on/off the 7seg 
# param[in] $a0 value to shown # remark $t0 changed 
#--------------------------------------------------------------- 
SHOW_7SEG_LEFT: li $t0, SEVENSEG_LEFT # assign port's address 
    sb $a0, 0($t0) # assign new value 
    jr $ra #--------------------------------------------------------------- 
# Function SHOW_7SEG_RIGHT : turn on/off the 7seg 
# param[in] $a0 value to shown # remark $t0 changed 
#--------------------------------------------------------------- 
SHOW_7SEG_RIGHT: li $t0, SEVENSEG_RIGHT # assign port's address 
    sb $a0, 0($t0) # assign new value 
    jr $ra 

display can but i dont know how to hit a button then display it. 
+0

請將此代碼粘貼到問題文本中,因爲它不是答案。那麼,您是否嘗試過調試?哪一行不能按預期工作? –