英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

标题: 用PIC16C57做的8路无线电遥控开关,可扩展32路 [打印本页]

作者: star    时间: 2012-8-21 16:26
标题: 用PIC16C57做的8路无线电遥控开关,可扩展32路
;*********************八路遥控开关************************** ;
WEI1 EQU 08H
WAY1 EQU 7H
WAY2 EQU 6H
WAY3 EQU 5H
WAY4 EQU 4H
WAY5 EQU 3H
WAY6 EQU 2H
WAY7 EQU 1H
WAY8 EQU 0H
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 GOTO K2 GOTO K3 GOTO K4 GOTO K5 GOTO K6 GOTO K7 GOTO K8 GOTO K9 GOTO K10 GOTO K11 GOTO K12 GOTO CHECK GOTO CHECK GOTO CHECK GOTO CHECK ;----------------------------------------------------------- K1: BTFSS WEI1,0 GOTO CHECK MOVLW 10000000B XORWF PORTC,F 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





欢迎光临 英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 (http://enroobbs.com/) Powered by Discuz! X3.2