新會員
Joined
: 2006/7/27 21:50 最後登入時間
: 2010/8/13 4:27
Group:
註冊會員
Level : 2 HP : 0 / 28 MP : 3 / 1501 EXP : 12
|
我的MCU本來是8MHz但我後來換成16MHz 程式沒變,我本來會正常掃瞄跟正常掃key的但目前我換成16後變得完全不一樣。以下是我一小段程式。 就是掃瞄七段跟按鍵的程式,本來只要按下掃到LGT1這行又判斷PORTC,1及,3如果是LOW訊號則CLEAR那個旗標的BIT,正常按START就是START、STOP就是STOP,現在變成按START沒反應,則按下STOP會變成除了把它原本的BTFLAG,1設成0後但奇怪的是START(BTFLAG,0)也被設成0了請幫幫忙^^
MOVLW 0X00 MOVWF PCLATH BANKSEL SCFLAG_TMP MOVFF SCFLAG,SCFLAG_TMP RLNCF SCFLAG_TMP,F RLNCF SCFLAG_TMP,W BANKSEL DIG1 ADDWF PCL,F GOTO LGT1 GOTO LGT2 GOTO LGT3 GOTO LGT4 GOTO LGT5 GOTO LGT6 GOTO LGT7 GOTO LGT8 GOTO LGT9 GOTO LGT10 GOTO LGT11 GOTO LGT12 GOTO LGT13 GOTO LGT14 GOTO LGT15 GOTO LGT16 GOTO LGT17 GOTO LGT18 GOTO LGT19 GOTO LGT20 GOTO LGT21 GOTO LGT22
LGT1 MOVLW 0X07 MOVWF PORTE BANKSEL DIG1 MOVF DIG1,W MOVWF DISPLAY INCF SCFLAG,1 BCF LATC,6 BCF LATC,7 BCF LATB,4 BCF LATB,5 BCF CS74154 BSF BTFLAG,0 BTFSS PORTC,1 BCF BTFLAG,0 ;start BSF BTFLAG2,0 BTFSS PORTC,3 BCF BTFLAG2,0 ;10 GOTO TMR_END LGT2 BSF CS74154 BANKSEL DIG2 MOVF DIG2,W MOVWF DISPLAY INCF SCFLAG,1 BCF LATB,4 BCF LATB,5 BSF LATC,6 BCF LATC,7 BCF CS74154 BSF BTFLAG,1 BTFSS PORTC,1 BCF BTFLAG,1 ;stop BSF BTFLAG2,1 BTFSS PORTC,3 BCF BTFLAG2,1 ;8 GOTO TMR_END LGT3 BSF CS74154 BANKSEL DIG3 MOVF DIG3,W MOVWF DISPLAY INCF SCFLAG,1 BCF LATB,4 BCF LATB,5 BCF LATC,6 BSF LATC,7 BCF CS74154 BSF BTFLAG,2 BTFSS PORTC,1 BCF BTFLAG,2 BSF BTFLAG2,2 BTFSS PORTC,3 BCF BTFLAG2,2 GOTO TMR_END LGT4 BSF CS74154 BANKSEL DIG4 MOVF DIG4,W MOVWF DISPLAY INCF SCFLAG,1 BCF LATB,4 BCF LATB,5 BSF LATC,6 BSF LATC,7 BCF CS74154 BSF BTFLAG,3 BTFSS PORTC,1 BCF BTFLAG,3 BSF BTFLAG2,3 BTFSS PORTC,3 BCF BTFLAG2,3 GOTO TMR_END LGT5 BSF CS74154 BANKSEL DIG5 MOVF DIG5,W MOVWF DISPLAY INCF SCFLAG,1 BCF LATB,4 BSF LATB,5 BCF LATC,6 BCF LATC,7 BCF CS74154 BSF BTFLAG,4 BTFSS PORTC,1 BCF BTFLAG,4 BSF BTFLAG2,4 BTFSS PORTC,3 BCF BTFLAG2,4
發表於: 2007/6/19 3:27
|