基于vhdl_的_数字钟的设计内容摘要:
: out std_logic_vector(3 downto 0)。 mo0,mo1 : out std_logic_vector(3 downto 0)。 ya0,ya1 : out std_logic_vector(3 downto 0)。 en : in std_logic。 en 接上一个模块小时的进位 lock : in std_logic_vector(2 downto 0) )。 end daymony1。 architecture Behavioral of daymony1 is signal dat0 : std_logic_vector(3 downto 0):=0110。 signal dat1 : std_logic_vector(3 downto 0):=0001。 signal mon0 : std_logic_vector(3 downto 0):=0001。 signal mon1 : std_logic_vector(3 downto 0):=0000。 signal yea0 : std_logic_vector(3 downto 0):=0100。 signal yea1 : std_logic_vector(3 downto 0):=0001。 signal day_out,month_out:std_logic。 程序内部天和月的进位,也可放于前面设为 buffer begin da0=dat0。 da1=dat1。 mo0=mon0。 mo1=mon1。 ya0=yea0。 ya1=yea1。 年月日赋初值 P1:process (clk0,en,lock)天的输出,分大月和小月,以及二月 begin if en=39。 139。 then 时分秒模块有进位使能年月日 if lock=001then if clk039。 event AND clk0=39。 139。 then if (mon0=0001and mon1=0000)or(mon0=0011and mon1=0000) or(mon0=0101and mon1=0000)or(mon0=0111and mon1=0000) or(mon0=1000and mon1=0000)or(mon0=0000and mon1=0001) or(mon0=0010and mon1=0001)then 1 3 5 7 8 10 12 月为 31 天 if dat0=0001 and dat1=0011then dat0=0001。 dat1=0000。 day_out=39。 139。 elsif dat0=1001then dat0=0000。 dat1=dat1+1。 day_out=39。 039。 else dat0=dat0+39。 139。 dat1=dat1。 day_out=39。 039。 end if。 elsif(mon0=0100and mon1=0000)or(mon0=0110and mon1=0000) or(mon0=1001and mon1=0000)or(mon0=0001and mon1=0001)then 4 6 9 11 月份 30 天 if dat0=0000 and dat1=0011then dat0=0001。 dat1=0000。 day_out=39。 139。 elsif dat0=1001then dat0=0000。 dat1=dat1+1。 day_out=39。 039。 else dat0=dat0+39。 139。 dat1=dat1。 day_out=39。 039。 end if。 Else 对闰年的判断 2 月 29 数码管只显示年后两位 前两位默认为 20 故只要后两位能被 4 整除即使闰年 if((yea1=0000OR yea1=0010OR yea1=0100OR yea1=0110 OR yea1=01000)AND(yea0=0000 OR yea0=0100OR yea0=01000))OR ((yea1=0001 OR yea1=0011 OR yea1=0101OR yea1=0111 OR yea1=1001)AND(yea0=0010OR yea0=0110)) THEN if dat0=1001 and dat1=0010then dat0=0001。 dat1=0000。 day_out=39。 139。 elsif dat0=1001then dat0=0000。 dat1=dat1+39。 139。 day_out=39。 039。 else dat0=dat0+39。 139。 dat1=dat1。 day_out=39。 039。 end if。 else 不是闰年,二月份 28 天 if dat0=1000 and dat1=0010then dat0=0001。 dat1=0000。 day_out=39。 139。 elsif dat0=1001then dat0=0000。 dat1=dat1+39。 139。 day_out=39。 039。 else dat0=dat0+39。 139。 dat1=dat1。 day_out=39。 039。 end if。 end if。 判断闰年的语句 end if。 判断月份的语句 end if。 对应 clk0 end if。 对应 lock end if。 对应使能 end process P1。 P2:process (day_out,lock)对月的输出 begin if lock=001then if day_out39。 event AND day_out=39。 139。 then 天数产生进位使月份加一 if mon0=0010 and mon1=0001then mon0=0001。 mon1=0000。 month_out=39。 139。 到十二月份后重新回到一月份产生月进位给年 elsif mon0=1001then mon0=0000。 mon1=mon1+39。 139。 month_out=39。 039。 else mon0=mon0+39。 139。 mon1=mon1。 month_out=39。 039。 end if。 end if。 end if。 end process P2。 P3:process (month_out,lock)对年的设制 begin if lock=001then if month_out39。 event AND month_out=39。 139。 then 月份产生进位使年加一 if yea0=1001and yea1=1001then yea0=0000。 yea1=0000。 elsif yea0=1001then yea0=0000。 yea1=yea1+39。 139。 else yea0=yea0+39。 139。 yea1=yea1。 end if。 end if。 end if。 end process P3。 end Behavioral。 分频 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 fenpin is port(upd0 : in std_logic。 clk : in std_logic。 f_clk : out std_logic。 lock : out std_logic_vector(2 downto 0) )。 end fenpin。 architecture Behavioral of fenpin is signal tem : std_logic_vector(2 downto 0):=000。 signal cout : std_logic_vector(8 downto 0):=000000000。 signal clk_o : std_logic。 begin lock=tem。 f_clk=clk_o。 process(upd0,clk ,cout) begin if clk 39。 event and clk =39。 139。 then if cout=111110011then cout=000000000。 clk_o=not clk_o。 else cout=cout+39。 139。 end if。 end if。 if upd039。 event and upd0=39。 139。 then tem=tem+39。 139。 end if。 end process。 end Behavioral。 时分秒 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 s_m_hour is port( clk0: in std_logic。 clk0 工作时钟, clk1 预置脉冲 lock : in std_logic_vector(2 downto 0)。 工作模式选择 s0,s1 : out std_logic_vector(3 downto 0)。 m0,m1 : out std_logic_vector(3 downto 0)。 h0,h1 : out std_logic_vector(3 downto 0)。 co : out std_logic。 _vector(2 downto 0)。 hour 产生进位 en : in std_logic )。 end s_m_hour。 architecture Behavioral of s_m_hour is signal ts0 : std_logic_vector(3 downto 0):=0100。 signal ts1 : std_logic_vector(3 downto 0):=0101。 signal tm0 : std_logic_vector(3 downto 0):=1001。 signal tm1 : std_logic_vector(3 downto 0):=0101。 signal th0 : std_logic_vector(3 down。基于vhdl_的_数字钟的设计
相关推荐
使 用 上 还 是 价 格 上 性 价 比 很 高。 用 51 型 单 片 机 设 计 温 度 检 测 控 制 系 统 ,能 够 准确 、 及 时 地 监 控 室 内 温 度 以 及 湿 度 的 变 化。 而 且 有 着 多 种 不 同 的 控 制 方 式。 将此 系 统 应 用 到 存 储 仓 库 中 使 军 需 物 资 有 更 加 适 宜 的 环 境。 使 其 对 抗 军 需 物 资
原理图 L298N 电机驱动模块 驱动模块简介 本设计采用双驱动的小车,驱动模块要分别控制小车的左、右两个电机, 使小车的两个车轮的转速和方向相同或不同,从而来控制它的前进和转弯。 在系统的设计过程中,用一个 L298N 芯片来分别连接单 片机和直流电机。 如图 6 所示。 L298N 是一个具有高电压大电流的全桥驱动芯片,它响应频率高,一片 L298N 可以分别控制两个直流电机
后,清洗发动机开始工作,清水对小车进行清洗。 在经过 30s 后,鼓风发动机开始工作,对小车进行风干处理, 经过 10 秒后,鼓风机停止工作, 按下停止开关 ,停止工作。 手动方式:按下选择开关 ,再按下 启动按钮,手动工作,按下,泡沫发动机开始工作。 按下 清洗发动机开始工作,按下 鼓风发动机开始工作,按下停止开关 ,停止工作。 选择开关 自动运行 手动运行 泡沫清洗 清水清洗 风 干 停 止
1+≈ 10。 8 CD40512的 A 脚和 B 脚为 1,其等效运放原理图如下图,其放大倍数为1+≈。 总的原理图如图所示 : 图 传感器信号输入电路 STC12C5A08S2单片机模块 新一代宏晶芯片 STC12C5A08S2具有 1 个时钟 /机器周期,高速、高可靠,2 路 PWM, 8 路 10 位高速 A/D 转换, 25 万次 /秒 1T 8051 带总线 ,管脚直接兼容传统
dispbuf[2]=16。 dispbuf[3]=16。 dispbuf[4]=16。 dispbuf[5]=16。 dispbuf[6]=16。 dispbuf[7]=16。 keycount=0。 } if(dd) {P3_3=0。 P3_5=1。 P3_4=1。 while(1) {if(!P3_5) { dispbuf[0]=18。 dispbuf[1]=16。