Estoy tratando de escribir un reloj digital en vhdl para un fpga que se ejecute en 100 mhz. Puedo escribirlo en 4 ánodos al crear un contador como se muestra a continuación (conteo 1 = 249999), los dígitos parecen bastante claros. Sin embargo, cuando quiero mostrar la hora en el formato HH: MM: SS (cuando quiero usar 6 ánodos en lugar de 4), no pude mostrar los dígitos claramente. Cuando incremento mucho el valor de count1, los LED comienzan a parpadear, cuando disminuyo el valor de count1, los dígitos parecen difíciles de identificar.
¿Hay alguna forma teórica de determinar este valor de contador (contador1)? ¿Es posible mostrar 6 dígitos claramente en la forma en que lo estoy intentando?
Gracias desde ahora.
el código responsable de mostrar 4 ánodos:
anode_clock : process(count1, clk_in, A_counter) -- counter to display all digits using anodes
begin
if(rising_edge(clk_in)) then
count1 <= count1 + 1;
if(count1 = 249999) then -- ATTENTION HERE
A_counter <= A_counter + 1;
count1 <= 0;
end if;
end if;
end process;
anode_display : process (A_counter, tmp_AN, min0, min1, hour0) begin -- matching anodes to display
AN <= tmp_AN;
case A_counter is
when 0 =>
tmp_AN <= "1110";
if (min0 = 0) then
DISP <= "1000000";
elsif min0 = 1 then
DISP <= "1111001";
elsif min0 = 2 then
DISP <= "0100100";
elsif min0 = 3 then
DISP <= "0110000";
elsif min0 = 4 then
DISP <= "0011001";
elsif min0 = 5 then
DISP <= "0010010";
elsif min0 = 6 then
DISP <= "0000010";
elsif min0 = 7 then
DISP <= "1111000";
elsif min0 = 8 then
DISP <= "0000000";
elsif min0 = 9 then
DISP <= "0010000";
end if;
when 1 =>
tmp_AN <= "1101";
if (min1 = 0) then
DISP <= "1000000";
elsif min1 = 1 then
DISP <= "1111001";
elsif min1 = 2 then
DISP <= "0100100";
elsif min1 = 3 then
DISP <= "0110000";
elsif min1 = 4 then
DISP <= "0011001";
elsif min1 = 5 then
DISP <= "0010010";
elsif min1 = 6 then
DISP <= "1000000";
end if;
when 2 =>
tmp_AN <= "1011";
if (hour0 = 0) then
DISP <= "1000000";
elsif hour0 = 1 then
DISP <= "1111001";
elsif hour0 = 2 then
DISP <= "0100100";
elsif hour0 = 3 then
DISP <= "0110000";
elsif hour0 = 4 then
DISP <= "0011001";
elsif hour0 = 5 then
DISP <= "0010010";
elsif hour0 = 6 then
DISP <= "0000010";
elsif hour0 = 7 then
DISP <= "1111000";
elsif hour0 = 8 then
DISP <= "0000000";
elsif hour0 = 9 then
DISP <= "0010000";
elsif hour0 = 10 then
DISP <= "1000000";
elsif hour0 = 11 then
DISP <= "1111001";
elsif hour0 = 12 then
DISP <= "0100100";
elsif hour0 = 13 then
DISP <= "1000000";
end if;
when 3 =>
tmp_AN <= "0111";
if (hour0 = 10) then
DISP <= "1111001";
elsif hour0 = 11 then
DISP <= "1111001";
elsif hour0 = 12 then
DISP <= "1111001";
else
DISP <= "1000000";
end if;
end case;
end process;
el código responsable de mostrar 6 ánodos (los dígitos no son claros para leer):
anode_clock : process(count1, clk_in, A_counter) -- counter to display all digits using anodes
begin
if(rising_edge(clk_in)) then
count1 <= count1 + 1;
if(count1 = 125000) then -- experimental value: 249999
A_counter <= A_counter + 1;
count1 <= 0;
end if;
end if;
end process;
anode_display : process (A_counter, tmp_AN, sec0,sec1, min0, min1, hour0) begin -- matching anodes to display
AN <= tmp_AN;
case A_counter is
when 0 =>
tmp_AN <= "111110";
if (sec0 = 0) then
DISP <= "1000000";
elsif sec0 = 1 then
DISP <= "1111001";
elsif sec0 = 2 then
DISP <= "0100100";
elsif sec0 = 3 then
DISP <= "0110000";
elsif sec0 = 4 then
DISP <= "0011001";
elsif sec0 = 5 then
DISP <= "0010010";
elsif sec0 = 6 then
DISP <= "0000010";
elsif sec0 = 7 then
DISP <= "1111000";
elsif sec0 = 8 then
DISP <= "0000000";
elsif sec0 = 9 then
DISP <= "0010000";
end if;
when 1 =>
tmp_AN <= "111101";
if (sec1 = 0) then
DISP <= "1000000";
elsif sec1 = 1 then
DISP <= "1111001";
elsif sec1 = 2 then
DISP <= "0100100";
elsif sec1 = 3 then
DISP <= "0110000";
elsif sec1 = 4 then
DISP <= "0011001";
elsif sec1 = 5 then
DISP <= "0010010";
elsif sec1 = 6 then
DISP <= "1000000";
end if;
when 2 =>
tmp_AN <= "111011";
if (min0 = 0) then
DISP <= "1000000";
elsif min0 = 1 then
DISP <= "1111001";
elsif min0 = 2 then
DISP <= "0100100";
elsif min0 = 3 then
DISP <= "0110000";
elsif min0 = 4 then
DISP <= "0011001";
elsif min0 = 5 then
DISP <= "0010010";
elsif min0 = 6 then
DISP <= "0000010";
elsif min0 = 7 then
DISP <= "1111000";
elsif min0 = 8 then
DISP <= "0000000";
elsif min0 = 9 then
DISP <= "0010000";
end if;
when 3 =>
tmp_AN <= "110111";
if (min1 = 0) then
DISP <= "1000000";
elsif min1 = 1 then
DISP <= "1111001";
elsif min1 = 2 then
DISP <= "0100100";
elsif min1 = 3 then
DISP <= "0110000";
elsif min1 = 4 then
DISP <= "0011001";
elsif min1 = 5 then
DISP <= "0010010";
elsif min1 = 6 then
DISP <= "1000000";
end if;
when 4 =>
tmp_AN <= "101111";
if (hour0 = 0) then
DISP <= "1000000";
elsif hour0 = 1 then
DISP <= "1111001";
elsif hour0 = 2 then
DISP <= "0100100";
elsif hour0 = 3 then
DISP <= "0110000";
elsif hour0 = 4 then
DISP <= "0011001";
elsif hour0 = 5 then
DISP <= "0010010";
elsif hour0 = 6 then
DISP <= "0000010";
elsif hour0 = 7 then
DISP <= "1111000";
elsif hour0 = 8 then
DISP <= "0000000";
elsif hour0 = 9 then
DISP <= "0010000";
elsif hour0 = 10 then
DISP <= "1000000";
elsif hour0 = 11 then
DISP <= "1111001";
elsif hour0 = 12 then
DISP <= "0100100";
elsif hour0 = 13 then
DISP <= "1000000";
end if;
when 5 =>
tmp_AN <= "011111";
if (hour0 = 10) then
DISP <= "1111001";
elsif hour0 = 11 then
DISP <= "1111001";
elsif hour0 = 12 then
DISP <= "1111001";
else
DISP <= "1000000";
end if;
end case;
end process;
la salida (los dígitos no son como yo quería, algo se ve mal con el contador de pantalla):