Hardware Reference
In-Depth Information
190
SDA <= not i2c_clk;
191
nx_state <= slave_addr_rd;
192
when slave_addr_rd =>
193
SDA <= slave_addr_for_rd(8-i);
194
i <= i_reg + 1;
195
if i=8 then
196
nx_state <= ack5;
197
else
198
nx_state <= slave_addr_rd;
199
end if;
200
when ack5 =>
201
SDA <= 'Z';
202
nx_state <= rd_sec;
203
when rd_sec =>
204
SDA <= 'Z';
205
i <= i_reg + 1;
206
if i=8 then
207
nx_state <= ack6;
208
else
209
nx_state <= rd_sec;
210
end if;
211
when ack6 =>
212
SDA <= '0';
213
nx_state <= rd_min;
214
when rd_min =>
215
SDA <= 'Z';
216
i <= i_reg + 1;
217
if i=8 then
218
nx_state <= ack7;
219
else
220
nx_state <= rd_min;
221
end if;
222
when ack7 =>
223
SDA <= '0';
224
nx_state <= rd_hour;
225
when rd_hour =>
226
SDA <= 'Z';
227
i <= i_reg + 1;
228
if i=8 then
229
nx_state <= no_ack;
230
else
231
nx_state <= rd_hour;
232
end if;
233
when no_ack =>
234
SDA <= '1';
235
nx_state <= stop;
236
end case;
237
end process;
238
239
--Store data read from RTC and send it to display:
240
process (i2c_clk)
241
begin
242
if rising_edge(i2c_clk) then
243
if (pr_state=rd_sec) then
244
sec(8-i) <= SDA;
245
elsif (pr_state=rd_min) then
Search WWH ::




Custom Search