專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命
提供開發(fā)工具、應(yīng)用測試 完善的開發(fā)代碼案例庫分享
從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無限潛能!
提供新的芯片及解決方案,提升客戶產(chǎn)品競爭力
提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動態(tài)
*********************8路遙控開關(guān)**************************
;
SIGNAL EQU 3H
BAORD1 EQU 2H
BAORD2 EQU 1H
BAORD3 EQU 0H
BAORD4 EQU 3H
ORG 0H
INTI:
MOVLW 00000000B
MOVWF PORTC
TRIS PORTC
MOVWF PORTC
MOVLW 11111111B
TRIS PORTA
TRIS PORTB
CLRF WEI1
;-------------------------------------------------------------
;檢測有無信號
CHECK:
BTFSS PORTB,SIGNAL
GOTO $-1
SWAPF PORTB,W
ANDLW 00001111B
ADDWF PCL,F
NOP
GOTO K1 ;按鍵1
GOTO K2 ;按鍵2
GOTO K3 ;按鍵3
GOTO K4 ;按鍵4
GOTO K5 ;按鍵5
GOTO K6 ;按鍵6
GOTO K7 ;按鍵7
GOTO K8 ;按鍵8
GOTO K9 ;按鍵9
GOTO K10 ;按鍵10
GOTO K11 ;按鍵11
GOTO K12 ;按鍵12
GOTO CHECK
;-----------------------------------------------------------
K1:
BTFSS WEI1,0 ;檢測組群信號
GOTO CHECK
MOVLW 10000000B
XORWF PORTC,F ;雙穩(wěn)反轉(zhuǎn)
BTFSC PORTB,SIGNAL ;檢測遙控器 按鍵是否松開
GOTO $-1
GOTO CHECK
K2:
BTFSS WEI1,0
GOTO CHECK
MOVLW 01000000B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K3:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00100000B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K4:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00010000B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K5:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00001000B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K6:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00000100B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K7:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00000010B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K8:
BTFSS WEI1,0
GOTO CHECK
MOVLW 00000001B
XORWF PORTC,F
BTFSC PORTB,SIGNAL
GOTO $-1
GOTO CHECK
K9:
CLRF WEI1
BTFSS PORTB,BAORD1
GOTO CHECK
BSF WEI1,0
GOTO CHECK
K10:
CLRF WEI1
BTFSS PORTB,BAORD2
GOTO CHECK
BSF WEI1,0
GOTO CHECK
K11:
CLRF WEI1
BTFSS PORTB,BAORD3
GOTO CHECK
BSF WEI1,0
GOTO CHECK
K12:
CLRF WEI1
BTFSS PORTA,BAORD4
GOTO CHECK
BSF WEI1,0
GOTO CHECK
ORG 7FFH
GOTO INTI
END