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

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 4013|回复: 0
打印 上一主题 下一主题

用PIC16C57做的8路无线电遥控开关,可扩展32路

[复制链接]
跳转到指定楼层
1#
发表于 2012-8-21 16:26:18 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
;*********************八路遥控开关************************** ;
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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-11-27 20:09 , Processed in 0.051994 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表