教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 精品文档 > 高等教育 >

基于FPGA的红外线型学习遥控器(4)

来源:网络收集 时间:2026-08-13
导读: architecture behav of hw_adout is type state is(s0,s1,s2,s3); signal sta:state; signal in1:std_logic_vector(15 downto 0); signal out1:std_logic_vector(31 downto 0); begin in1 if(anjian1='1'and anjian

architecture behav of hw_adout is type state is(s0,s1,s2,s3); signal sta:state;

signal in1:std_logic_vector(15 downto 0); signal out1:std_logic_vector(31 downto 0); begin in1<=inin; output<=out1; process(anjian1,clk) begin

if(anjian1='1'and anjian2='1'and anjian3='1')then sta<=s0;

out1<=x\

elsif(clk'event and clk ='1')then case sta is when s0=>

out1(15 downto 0)<=in1; sta<=s1; when s1=>if(out1=in1)then sta<=s1; else

out1(15 downto 0)<=in1; sta<=s2; end if; when s2=>if(out1=in1)then sta<=s2; else

out1(31 downto 16)<=in1;

12

sta<=s3; end if; when s3=>sta<=s3; end case; end if; end process; end behav; 红外发射程序

library ieee;

use ieee.std_logic_1164.all;

entity hw_OUTPUT is

port(CLK:in std_logic;--50MHz kin:in std_logic;

DATA:in std_logic_vector(31 downto 0); IROUT:out std_logic); end entity hw_OUTPUT ;

architecture one of hw_OUTPUT is type state is(s0,s1,s2,s3,s4); signal sta:state;

signal clk_1m:std_logic; --1MHz signal clk_38k:std_logic; --38kHz begin process(CLK)

variable clk_counter:integer range 0 to 25; begin

if(CLK'event and CLK='1')then clk_counter:=clk_counter+1; if(clk_counter=25)then clk_counter:=0; clk_1m<=not clk_1m; end if; end if; end process;

process(CLK)

variable clk_counter:integer range 0 to 658; begin

if(CLK'event and CLK='1')then clk_counter:=clk_counter+1; if(clk_counter=658)then

13

clk_counter:=0; clk_38k<=not clk_38k; end if; end if; end process;

process(kin,clk_1m)

variable step:integer range 0 to 32; variable counter:integer range 0 to 100000; begin

if(kin='1')then IROUT<='0'; step:=0; sta<=s1; counter:=0;

elsif(clk_1m'event and clk_1m='1')then case sta is

when s0=>IROUT<='0'; if(counter<100000)then counter:=counter+1; else sta<=s1; counter:=0; end if; when s1=>IROUT<=clk_38k; if(counter<9000)then counter:=counter+1; else sta<=s2; counter:=0; end if; when s2=>IROUT<='0'; if(counter<4500)then counter:=counter+1; else sta<=s3; counter:=0; end if;

when s3=>IROUT<=clk_38k; if(counter<560)then counter:=counter+1; else sta<=s4; counter:=0; end if;

when s4=>IROUT<='0';

14

if(DATA(step)='0')then if(counter<565)then counter:=counter+1; elsif(step<32)then sta<=s3; step:=step+1; counter:=0; else sta<=s0; step:=0; counter:=0; end if;

elsif(DATA(step)='1')then

if(counter<1690)then counter:=counter+1; elsif(step<32)then sta<=s3; step:=step+1; counter:=0; else sta<=s0; step:=0; counter:=0; end if; end if; end case; end if; end process;

end architecture one;

15

基于FPGA的红外线型学习遥控器(4).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wendang/606917.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)