仿真原理图如下(proteus仿真工程文件可到本帖附件中下载)
单片机源程序如下:
- rem Main.bas file generated by New Project wizard
- rem RC5编码发射
- rem Created: 周六 12月 21 2019 taotie
- rem Processor: ATmega8
- rem Compiler: BASCOM-AVR
- rem Write your code here
- $regfile ="m8def.dat"
- $crystal =8000000
- DDRD=&B00000000
- PORTD=&B11111111
-
- main:
- do
- if pind.0=0 then Rc5send 0 , 0,1
- waitms 80
- if pind.0=0 then Rc5send 0, 0,1
- waitms 80
-
- if pind.1=0 then Rc5send 0,0,2
- waitms 80
- if pind.1=0 then Rc5send 0,0,2
- waitms 80
-
- if pind.2=0 then Rc5send 0,0,3
- waitms 80
- if pind.2=0 then Rc5send 0,0,3
- waitms 80
-
- if pind.3=0 then Rc5send 0,0,4
- waitms 80
- if pind.3=0 then Rc5send 0,0,4
- waitms 80
-
- if pind.4=0 then Rc5send 0,0,5
- waitms 80
- if pind.4=0 then Rc5send 0,0,5
- waitms 80
- loop
- end
复制代码
所有资料51hei提供下载:
rc5.zip
(363.09 KB, 下载次数: 47)
|