请问如何通过FPGA驱动VGA显示一个圆形

 我来答
jdfeod
推荐于2017-10-02
知道答主
回答量:2
采纳率:0%
帮助的人:2.5万
展开全部
利用圆的方程X^2+Y^2<=z^2.x是行扫描计数值与圆心的差,y是列扫描与圆心的差。这是你要的圆的半径。我给你贴一段程序,我自己写的12个圆环,分了四个象限,比较蠢。不分象限的话要用无符号数。
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity vga_block isport (clk_40mhz:in std_logic; forming:in integer range 0 to 3; coulour:in integer range 0 to 2; h_or_f:in integer range 0 to 1;vga_out:out std_logic_vector(2 downto 0);hs1,vs1:out std_logic);end;architecture behave of vga_block issignal counter_hs:integer range 0 to 1055; --屏幕中行信号 HS 使用范围signal counter_vs:integer range 0 to 627; --屏幕中场信号 VS 使用范围signal hs,vs:std_logic:='1'; --行信号 hs 和场信号 vs 高电平signal rgb1,rgb2,rgb3:std_logic_vector(2 downto 0); --水平和垂直方向上表示 3 基色的中间变量signal coulour1,coulour2: std_logic_vector(2 downto 0);beginprocess(clk_40mhz) --40MHZ 触发在每行上逐点扫描beginif rising_edge(clk_40mhz) then if counter_hs>=1055 then counter_hs<=0;else counter_hs<=counter_hs+1;end if;end if;end process;process(counter_hs) --行消隐beginif counter_hs>=0 and counter_hs<128 thenhs<='0';elsehs<='1';end if;end process;process(hs)beginif falling_edge(hs) then --VGA 中行同步负脉冲有效if counter_vs>=627 thencounter_vs<=0;else counter_vs<=counter_vs+1; --垂直扫描end if;end if;end process;process(counter_vs) --场消隐beginif counter_vs>=0 and counter_vs<=3 thenvs<='0';elsevs<='1';end if;end process;
process(counter_hs,counter_vs)
if (counter_hs >=216 and counter_hs <=616) then if (counter_vs >=27 and counter_vs <=327) then if (((327-counter_vs)**2+(616-counter_hs)**2) <=90000 and ((327-counter_vs)**2+(616-counter_hs)**2) >=75625)or(((327-counter_vs)**2+(616-counter_hs)**2) < 62500 and ((327-counter_vs)**2+(616-counter_hs)**2) >=50625)or(((327-counter_vs)**2+(616-counter_hs)**2) < 40000 and ((327-counter_vs)**2+(616-counter_hs)**2) >=30625)or(((327-counter_vs)**2+(616-counter_hs)**2) < 22500 and ((327-counter_vs)**2+(616-counter_hs)**2) >=15625)or(((327-counter_vs)**2+(616-counter_hs)**2) < 10000 and ((327-counter_vs)**2+(616-counter_hs)**2) >=5625)or(((327-counter_vs)**2+(616-counter_hs)**2) < 2500 and ((327-counter_vs)**2+(616-counter_hs)**2) >=625) then rgb1 <=coulour1; elsif (((327-counter_vs)**2+(616-counter_hs)**2) < 75625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=62500)or(((327-counter_vs)**2+(616-counter_hs)**2) < 50625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=40000)or(((327-counter_vs)**2+(616-counter_hs)**2) < 30625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=22500)or(((327-counter_vs)**2+(616-counter_hs)**2) < 15625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=10000)or(((327-counter_vs)**2+(616-counter_hs)**2) < 5625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=2500)or(((327-counter_vs)**2+(616-counter_hs)**2) < 625 and ((327-counter_vs)**2+(616-counter_hs)**2) >=0) then rgb1 <=coulour2;else rgb1 <="000";end if; elsif (counter_vs >=327 and counter_vs <=627) then if (((counter_vs-327)**2+(616-counter_hs)**2) <=90000 and ((counter_vs-327)**2+(616-counter_hs)**2) >=75625)or(((counter_vs-327)**2+(616-counter_hs)**2) < 62500 and ((counter_vs-327)**2+(616-counter_hs)**2) >=50625)or(((counter_vs-327)**2+(616-counter_hs)**2) < 40000 and ((counter_vs-327)**2+(616-counter_hs)**2) >=30625)or(((counter_vs-327)**2+(616-counter_hs)**2) < 22500 and ((counter_vs-327)**2+(616-counter_hs)**2) >=15625)or(((counter_vs-327)**2+(616-counter_hs)**2) < 10000 and ((counter_vs-327)**2+(616-counter_hs)**2) >=5625)or(((counter_vs-327)**2+(616-counter_hs)**2) < 2500 and ((counter_vs-327)**2+(616-counter_hs)**2) >=625) then rgb1 <=coulour1; elsif (((counter_vs-327)**2+(616-counter_hs)**2) < 75625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=62500)or(((counter_vs-327)**2+(616-counter_hs)**2) < 50625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=40000)or(((counter_vs-327)**2+(616-counter_hs)**2) < 30625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=22500)or(((counter_vs-327)**2+(616-counter_hs)**2) < 15625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=10000)or(((counter_vs-327)**2+(616-counter_hs)**2) < 5625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=2500)or(((counter_vs-327)**2+(616-counter_hs)**2) < 625 and ((counter_vs-327)**2+(616-counter_hs)**2) >=0) then rgb1 <=coulour2;else rgb1 <="000";end if; end if; elsif (counter_hs >=616 and counter_hs <=1016) then if (counter_vs >=27 and counter_vs <=327) then if (((327-counter_vs)**2+(counter_hs-616)**2) <=90000 and ((327-counter_vs)**2+(counter_hs-616)**2) >=75625)or(((327-counter_vs)**2+(counter_hs-616)**2) < 62500 and ((327-counter_vs)**2+(counter_hs-616)**2) >=50625)or(((327-counter_vs)**2+(counter_hs-616)**2) < 40000 and ((327-counter_vs)**2+(counter_hs-616)**2) >=30625)or(((327-counter_vs)**2+(counter_hs-616)**2) < 22500 and ((327-counter_vs)**2+(counter_hs-616)**2) >=15625)or(((327-counter_vs)**2+(counter_hs-616)**2) < 10000 and ((327-counter_vs)**2+(counter_hs-616)**2) >=5625)or(((327-counter_vs)**2+(counter_hs-616)**2) < 2500 and ((327-counter_vs)**2+(counter_hs-616)**2) >=625) then rgb1 <=coulour1; elsif (((327-counter_vs)**2+(counter_hs-616)**2) < 75625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=62500)or(((327-counter_vs)**2+(counter_hs-616)**2) < 50625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=40000)or(((327-counter_vs)**2+(counter_hs-616)**2) < 30625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=22500)or(((327-counter_vs)**2+(counter_hs-616)**2) < 15625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=10000)or(((327-counter_vs)**2+(counter_hs-616)**2) < 5625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=2500)or(((327-counter_vs)**2+(counter_hs-616)**2) < 625 and ((327-counter_vs)**2+(counter_hs-616)**2) >=0) then rgb1 <=coulour2;else rgb1 <="000";end if; elsif (counter_vs >=327 and counter_vs <=627) then if (((counter_vs-327)**2+(counter_hs-616)**2) <=90000 and ((counter_vs-327)**2+(counter_hs-616)**2) >=75625)or(((counter_vs-327)**2+(counter_hs-616)**2) < 62500 and ((counter_vs-327)**2+(counter_hs-616)**2) >=50625)or(((counter_vs-327)**2+(counter_hs-616)**2) < 40000 and ((counter_vs-327)**2+(counter_hs-616)**2) >=30625)or(((counter_vs-327)**2+(counter_hs-616)**2) < 22500 and ((counter_vs-327)**2+(counter_hs-616)**2) >=15625)or(((counter_vs-327)**2+(counter_hs-616)**2) < 10000 and ((counter_vs-327)**2+(counter_hs-616)**2) >=5625)or(((counter_vs-327)**2+(counter_hs-616)**2) < 2500 and ((counter_vs-327)**2+(counter_hs-616)**2) >=625) then rgb1 <=coulour1; elsif (((counter_vs-327)**2+(counter_hs-616)**2) < 75625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=62500)or(((counter_vs-327)**2+(counter_hs-616)**2) < 50625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=40000)or(((counter_vs-327)**2+(counter_hs-616)**2) < 30625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=22500)or(((counter_vs-327)**2+(counter_hs-616)**2) < 15625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=10000)or(((counter_vs-327)**2+(counter_hs-616)**2) < 5625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=2500)or(((counter_vs-327)**2+(counter_hs-616)**2) < 625 and ((counter_vs-327)**2+(counter_hs-616)**2) >=0) then rgb1 <=coulour2;else rgb1 <="000";end if; end if; end if;--圆环
hs1 <= hs;vs1 <= vs;Vga_out<=rgb1 end process;end;
深圳市大雅新科技有限公司
2020-03-06 广告
这方面更多更全面的信息其实可以找下大雅新。深圳市大雅新科技有限公司从事KVM延长器,DVI延长器,USB延长器,键盘鼠标延长器,双绞线视频传输器,VGA视频双绞线传输器,VGA延长器,VGA视频延长器,DVI KVM 切换器等,优质供应商,... 点击进入详情页
本回答由深圳市大雅新科技有限公司提供
loveKEYBOARD
2013-12-27 · TA获得超过382个赞
知道小有建树答主
回答量:746
采纳率:86%
帮助的人:374万
展开全部
VGA显示器是模拟的三基色输入,所以用FPGA驱动的话,首先要三个D/A转换器,当然如果只是显示一个圆形,FPGA用I/O口外搞几个电阻也是可以实现显示一个只有几种颜色的圆形。不知道你的具体要求,如果有实验箱什么的,一般上面应该有D/A转换器,而且有VGA接口,只要正确驱动就可以了。那你再具体描述一下你的要求?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式