资源描述:
《Vhdl1602可调数字钟》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、...--LCD1602数字钟--Libraryieee;Useieee.std_logic_1164.all;Useieee.std_logic_arith.all;Useieee.std_logic_unsigned.all;EntityclockisPort(rst,clk:instd_logic;rs,en,rst_out,sec_out:outstd_logic;rw:outstd_logic;data_out:outstd_logic_vector(7downto0);RD,WR:INSTD_LOGIC;--读
2、写控制DATA_O,CONT_O:OUTSTD_LOGIC_VECTOR(7DOWNTO0);--数据输出DATA_I,CONT_I:INSTD_LOGIC_VECTOR(7DOWNTO0);--数据和地址输入SCLK:OUTSTD_LOGIC;IO:INOUTSTD_LOGIC;IOB:OUTSTD_LOGIC;k1,k2:INSTD_LOGIC);Endclock;ArchitecturefwmofclockisTYPEstatesword可编辑...IS(hold,func_set,dis_on,mode_set,w
3、rite_char1,write_char2,write_char3,write_char4,write_char5,write_char6,write_char7,write_char8,write_char9,write_char10,return_home,toggle_e,rst1,rst2,rst3,dis_off,dis_clr);SIGNALstate,n_state:states;SIGNALs0,s1,m0,m1,h0,h1,t:std_logic_vector(3downto0);SIGNALclk_4
4、00Hz,clk_10Hz,clk_40Hz:std_logic;SIGNALDATA_TEMP:STD_LOGIC_VECTOR(7DOWNTO0);SIGNALCONT_TEMP:STD_LOGIC_VECTOR(7DOWNTO0);SIGNALSECOND:STD_LOGIC_VECTOR(7DOWNTO0);SIGNALMINUTE:STD_LOGIC_VECTOR(7DOWNTO0);SIGNALHOUR:STD_LOGIC_VECTOR(7DOWNTO0);SIGNALDAY:STD_LOGIC_VECTOR(
5、7DOWNTO0);CONSTANTPROCECT:STD_LOGIC_VECTOR:="10001110";--保护位CONSTANTSECOND_WRITE:STD_LOGIC_VECTOR:="10000000";CONSTANTSECOND_READ:STD_LOGIC_VECTOR:="10000001";CONSTANTMINUTE_WRITE:STD_LOGIC_VECTOR:="10000010";CONSTANTMINUTE_READ:STD_LOGIC_VECTOR:="10000011";CONSTA
6、NTHOUR_WRITE:STD_LOGIC_VECTOR:="10000100";CONSTANTHOUR_READ:STD_LOGIC_VECTOR:="10000101";CONSTANTDAY_WRITE:STD_LOGIC_VECTOR:="10000110";word可编辑...CONSTANTDAY_READ:STD_LOGIC_VECTOR:="10000111";--CONSTANTMONTH_WRITE:STD_LOGIC_VECTOR:="10001000";--CONSTANTMONTH_READ:
7、STD_LOGIC_VECTOR:="10001001";--CONSTANTYEAR_WRITE:STD_LOGIC_VECTOR:="10001100";--CONSTANTYEAR_READ:STD_LOGIC_VECTOR:="10001101";Beginrst_out<=NOTrst;sec_out<=s0(0);Process(clk,rst)--50MHz分频到400Hzvariablecnt1:integerrange0to62500;beginifrst='0'thencnt1:=0;clk_400Hz
8、<='0';elsifclk'EVENTandclk='1'thenifcnt1<62500thencnt1:=cnt1+1;elsecnt1:=0;clk_400HZ<=notclk_400Hz;endif;endif;endprocess;process(clk_400HZ,rst)variable