Hardware Reference
In-Depth Information
76
counter1 := 0;
77
counter2 := counter2 + 1;
78
if counter2=10 then
79
counter2 := 0;
80
counter3 := counter3 + 1;
81
if counter3=6 then
82
counter3 := 0;
83
counter4 := counter4 + 1;
84
if counter4=10 then
85
counter4 := 0;
86
counter5 := counter5 + 1;
87
if counter5=6 then
88
counter5 := 0;
89
counter6 := counter6 + 1;
90
if (counter7/=2 and counter6=10) OR
91
(counter7=2 and counter6=4) then
92
counter6 := 0;
93
counter7 := counter7 + 1;
94
if counter7=3 then
95
counter7 := 0;
96
end if;
97
end if;
98
end if;
99
end if;
100
end if;
101
end if;
102
end if;
103
end if;
104
secU <= counter2;
105
secT <= counter3;
106
minU <= counter4;
107
minT <= counter5;
108
hourU <= counter6;
109
hourT <= counter7;
110
end process;
111
112
--PART II: LCD DRIVER BLOCK--------------------
113
114
LCD_ON <= '1';
115
BKLT_ON <= '1';
116
RW <= '0';
117
118
--Generate 500Hz enable (E):
119
process (clk)
120
variable counter1: natural range 0 to fclk/1000;
121
begin
122
if rising_edge(clk) then
123
counter1 := counter1 + 1;
124
if counter1=fclk/1000 then
125
counter1 := 0;
126
E <= not E;
127
end if;
128
end if;
129
end process;
130
131
--FSM state register:
132
process (E, rst_lcd)
Search WWH ::




Custom Search