基于fpga数字电压表设计内容摘要:

1=39。 039。 then t:=t+1。 case t is when 1=cba=000。 dw1=1。 when 2=cba=001。 dw1=2。 when others=cba=000。 dw1=1。 end case。 end if。 end if。 end if。 end process。 end Behavioral。 15 显示; library IEEE。 use。 use。 use。 Unment the following lines to use the declarations that are provided for instantiating Xilinx primitive ponents. library UNISIM。 use。 entity lcd is generic(delay:integer:=100)。 类属说明 Port ( clk,reset:in std_logic。 dw1:in integer range 0 to 2。 v1,v2,v3,v4,v5:in integer range 0 to 9。 lcden:out std_logic。 接 LCD使能端 lcdda:out std_logic。 接 LCD_da信号输入端 lcdrw:out std_logic。 接 LCD读写信号输入端 lcddata:inout std_logic_vector(7 downto 0))。 接 LCD数据输入位 end lcd。 architecture Behavioral of lcd is signal clk_500hz:std_logic。 type state is (set_dlnf,clear_lcd,set_cursor,set_dcb,set_location,write_data)。 signal current_state:state。 type ram is array(0 to 9) of std_logic_vector(7 downto 0)。 signal dataram :ram。 signal x1,x2,xv1,xv2,xv3,xv4,xv5:std_logic_vector(7 downto 0)。 constant v:std_logic_vector(7 downto 0):=01010110。 F constant g:std_logic_vector(7 downto 0):=00101101。 横杠 constant k:std_logic_vector(7 downto 0):=00100000。 空格 constant d:std_logic_vector(7 downto 0):=00101110。 小数点 constantdw:std_logic_vector(7 downto 0):=01110110。 单位 v begin process(clk,reset,clk_500hz) variable t:integer range 0 to 5000。 1khz begin if reset=39。 039。 then t:=0。 clk_500hz=39。 039。 elsif clk39。 event and clk=39。 139。 then t:=t+1。 if t2500 then clk_500hz=39。 139。 16 elsif t5000 then clk_500hz=39。 039。 else t:=0。 clk_500hz=39。 039。 end if。 end if。 end process。 process(clk,dw1) begin if clk39。 event and clk=39。 139。 then case dw1 is when 1=x1=d。 x2=k。 1 档 when 2=x1=k。 x2=d。 10 档 when others=x1=00111111。 x2=00111111。 end case。 end if。 end process。 process(clk,v1,v2,v3,v4,v5) begin if clk39。 event and clk=39。 139。 then case v1 is when 0=xv1=00110000。 when 1=xv1=00110001。 when 2=xv1=00110010。 when 3=xv1=00110011。 when 4=xv1=00110100。 when 5=xv1=00110101。 when 6=xv1=00110110。 when 7=xv1=00110111。 when 8=xv1=00111000。 when 9=xv1=00111001。 when others=xv1=00111111。 end case。 case v2 is when 0=xv2=00110000。 when 1=xv2=00110001。 when 2=xv2=00110010。 when 3=xv2=00110011。 when 4=xv2=00110100。 when 5=xv2=00110101。 when 6=xv2=00110110。 when 7=xv2=00110111。 when 8=xv2=00111000。 17 when 9=xv2=00111001。 when others=xv2=00111111。 end case。 case v3 is when 0=xv3=00110000。 when 1=xv3=00110001。 when 2=xv3=00110010。 when 3=xv3=00110011。 when 4=xv3=00110100。 when 5=xv3=00110101。 when 6=xv3=00110110。 when 7=xv3=00110111。 when 8=xv3=00111000。 when 9=xv3=00111001。 when others=xv3=00111111。 end case。 case v4 is when 0=xv4=00110000。 when 1=xv4=00110001。 when 2=xv4=00110010。 when 3=xv4=00110011。 when 4=xv4=00110100。 when 5=xv4=00110101。 when 6=xv4=00110110。 when 7=xv4=00110111。 when 8=xv4=00111000。 when 9=xv4=00111001。 when others=xv4=00111111。 end case。 case v5 is when 0=xv5=00110000。 when 1=xv5=00110001。 when 2=xv5=00110010。 when 3=xv5=00110011。 when 4=xv5=00110100。 when 5=xv5=00110101。 when 6=xv5=00110110。 when 7=xv5=00110111。 when 8=xv5=00111000。 when 9=xv5=00111001。 when others=xv5=00111111。 18 end case。 end if。 end process。 process(clk,reset) begin if reset=39。 039。 then dataram=((00110000),(00110000),(00110000),(00110000), (00110000),(00110000),(00110000),(00110000), (00110000),(00110000))。 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 tt,t2:integer。 begin if reset=39。 039。 then current_state=set_dlnf。 tt:=0。 t2:=0。 elsif rising_edge(clk_500hz)then case current_state is when set_dlnf= lcden=39。 039。 lcdda=39。 039。 lcdrw=39。 039。 lcddata=00111100。 功能设置 tt:=tt+1。 if ttdelay and tt=delay*2 then lcden=39。 139。 else 19 lcden=39。 039。 end if。 if tt=delay*3 then current_state=clear_lcd。 tt:=0。 end if。 when clear_lcd= lcden=39。 039。 lcdda=39。 039。 lcdrw=39。 039。 lcddata=00000001。 清屏 tt:=tt+1。 if ttdelay and tt=delay*2 then lcden=39。 139。 else lcden=39。 039。 end if。 if tt=delay*3 then current_state=set_cursor。 tt:=0。 end if。 when set_cursor= lcden=39。 039。 lcdda=39。 039。 lcdrw=39。 039。 lcddata=00000110。 输。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。