基于FPGA的数字电压表设计(4)

2019-04-09 21:13

elsif cnt<5000 then clk_500hz<='0'; else cnt:=0;clk_500hz<='0';

end if;

end if;

end process;

process(clk,dw1) begin

if clk'event and clk='1' then case dw1 is

when 1=>x1<=d;x2<=k;---1 档

when 2=>x1<=k;x2<=d;---10 档

when others=>x1<=\

end case;

end if;

end process;

process(clk,v1,v2,v3,v4,v5) begin

if clk'event and clk='1' then case v1 is when 0=>xv1<=\

when 1=>xv1<=\ when 2=>xv1<=\ when 3=>xv1<=\ when 4=>xv1<=\ when 5=>xv1<=\ when 6=>xv1<=\ when 7=>xv1<=\ when 8=>xv1<=\ when 9=>xv1<=\

when others=>xv1<=\

end case;

case v2 is when 0=>xv2<=\

when 1=>xv2<=\ when 2=>xv2<=\ when 3=>xv2<=\ when 4=>xv2<=\ when 5=>xv2<=\ when 6=>xv2<=\ when 7=>xv2<=\

when 8=>xv2<=\

16

when 9=>xv2<=\

when others=>xv2<=\

end case; case v3 is when 0=>xv3<=\

when 1=>xv3<=\ when 2=>xv3<=\ when 3=>xv3<=\ when 4=>xv3<=\ when 5=>xv3<=\ when 6=>xv3<=\ when 7=>xv3<=\ when 8=>xv3<=\ when 9=>xv3<=\

when others=>xv3<=\

end case;

case v4 is when 0=>xv4<=\

when 1=>xv4<=\ when 2=>xv4<=\ when 3=>xv4<=\ when 4=>xv4<=\ when 5=>xv4<=\ when 6=>xv4<=\ when 7=>xv4<=\ when 8=>xv4<=\ when 9=>xv4<=\

when others=>xv4<=\

end case;

case v5 is when 0=>xv5<=\

when 1=>xv5<=\ when 2=>xv5<=\ when 3=>xv5<=\ when 4=>xv5<=\ when 5=>xv5<=\ when 6=>xv5<=\ when 7=>xv5<=\ when 8=>xv5<=\ when 9=>xv5<=\

when others=>xv5<=\

17

end case; end if; end process;

process(clk,reset) begin if reset='0'then dataram<=((\ (\

(\

elsif rising_edge(clk)then

dataram(0)<=v; dataram(1)<=g; dataram(2)<=xv1; dataram(3)<=x1; dataram(4)<=xv2; dataram(5)<=x2; dataram(6)<=xv3; dataram(7)<=xv4; dataram(8)<=xv5;

dataram(9)<=dw;

end if;

end process;

process(clk_500hz,reset,dataram) variable cntt,cnt2:integer; begin if reset='0'then current_state<=set_dlnf;

cntt:=0;cnt2:=0;

elsif rising_edge(clk_500hz)then case current_state is when set_dlnf=> lcden<='0'; lcdda<='0'; lcdrw<='0';

lcddata<=\功能设置 cntt:=cntt+1;

if cntt>delay and cntt<=delay*2 then

lcden<='1';

else

18

lcden<='0'; end if;

if cntt=delay*3 then

current_state<=clear_lcd; cntt:=0;

end if;

when clear_lcd=> lcden<='0';

lcdda<='0'; lcdrw<='0';

lcddata<=\清屏

cntt:=cntt+1;

lcden<='1';

else

lcden<='0'; end if;

if cntt=delay*3 then

current_state<=set_cursor; cntt:=0;

end if;

lcden<='0'; lcdda<='0'; lcdrw<='0';

lcddata<=\输入方式设置

cntt:=cntt+1;

lcden<='1';

else

lcden<='0'; end if;

if cntt=delay*3 then current_state<=set_dcb; cntt:=0;

end if;

lcden<='0'; lcdda<='0'; lcdrw<='0';

lcddata<=\---显示开关控制

cntt:=cntt+1;

if cntt>delay and cntt<=delay*2 then

lcden<='1';

19

if cntt>delay and cntt<=delay*2 then

when set_cursor=>

if cntt>delay and cntt<=delay*2 then

when set_dcb=>

else lcden<='0'; end if;

if cntt=delay*3 then

current_state<=set_location; cntt:=0; end if;

when set_location=>

lcden<='0'; lcdda<='0'; lcdrw<='0';

lcddata<=\ ---DDRAM1设置

cntt:=cntt+1;

if cntt>delay and cntt<=delay*2 then lcden<='1';

else

lcden<='0';

end if;

if cntt=delay*3 then

current_state<=write_data; cntt:=0; end if;

when write_data=>

lcden<='0'; lcdda<='1'; lcdrw<='0'; if cnt2<=9 then

lcddata<=dataram(cnt2); ---写数据

cntt:=cntt+1;

if cntt>delay and cntt<=delay*2 then lcden<='1';

else lcden<='0'; end if;

if cntt=delay*3 then

current_state<=write_data; cntt:=0;

cnt2:=cnt2+1;

end if;

else cnt2:=0;

current_state<=set_cursor;

20


基于FPGA的数字电压表设计(4).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:湖北省鄂州市2018年中考语文试题(原卷版)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: