This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
projects:maps21:s:dcont:code:cpld2:cpld2 [2024/05/09 19:30] carsten [Erläuterungen] |
projects:maps21:s:dcont:code:cpld2:cpld2 [2024/10/06 15:24] (current) carsten [Code Orginal] |
||
---|---|---|---|
Line 2: | Line 2: | ||
====== Code für CPLD2 ====== | ====== Code für CPLD2 ====== | ||
+ | |||
+ | Eingestellt am 12.5.2024 --- erstellt am 9.5.2024. | ||
===== Erläuterungen ===== | ===== Erläuterungen ===== | ||
- | ^ Varable | + | ^ Varable |
- | | s = " | + | | s = " |
- | | t = Trafoindex Laufvariabel | + | | t = Trafoindex Laufvariabel |
- | | r = Reihe/ | + | | r = Reihe/ |
- | | m = Laufvariable Stelle im Bitstring stroke | + | | m = Laufvariable Stelle im Bitstring stroke |
- | | **trafosignals[5..0]** Bitstring[5..0] (<color green> | + | | **trafosignals[5..0]** Bitstring[5..0] (<color green> |
- | | **Stroke[4..0]** = Bitstring[4..0] Eingangsvariable 1ms-Takt | + | | **Stroke[4..0]** = Bitstring[4..0] Eingangsvariable 1ms-Takt |
- | | **Mode[2..0]** = Bitstring Mode[1..0] Eingangsvariable ^ c_num_measurement_ranges ✔ | = Anzahl Messbereich als Integerzahl = 3 | | + | | **Mode[2..0]** = Bitstring Mode[1..0] Eingangsvariable ^ | c_num_measurement_ranges ✔ | = Anzahl Messbereich als Integerzahl = 3 | |
- | | led_columns(t) | + | | ^ | c_period_wl ✔ | = Länge Perioden Bitstring[5..0] = 50 | |
- | | ^ c_period_wl ✔ | = Länge Perioden Bitstring[5..0] = 50 | | + | | **led_columns(t)** = sieben Spalten |
- | ^ ^^^ | + | | **led_rows_red(t)** = zehn Zeilen rot |
- | | p_drive_led_rows: | + | | **led_rows_green(t)** = zehn Zeilen green |
- | | p_debounce_and_handle_switches | + | | rotary_switch_debounced |
- | + | | rotary_switch_debounced_d1 | |
+ | | ^ | | | | ||
+ | | ^ | | | | ||
+ | | ^ | | | | ||
+ | ^ ^^^^ | ||
+ | | <color /# | ||
+ | | <color /# | ||
+ | | <color /# | ||
+ | | <color /# | ||
+ | |||
===== Code Orginal ===== | ===== Code Orginal ===== | ||
Line 95: | Line 107: | ||
period_cntr <= period_cntr + 1; | period_cntr <= period_cntr + 1; | ||
end if; | end if; | ||
- | -- create blink signal with 1 Hz | + | -- create blink signal with 1 Hz: 1 bei 24 0 Priode 49! |
if period_cntr = to_unsigned(c_num_20ms_periods / 2 - 1, c_period_wl) then | if period_cntr = to_unsigned(c_num_20ms_periods / 2 - 1, c_period_wl) then | ||
blink_signal <= ' | blink_signal <= ' | ||
Line 117: | Line 129: | ||
if mode <= to_unsigned(1, | if mode <= to_unsigned(1, | ||
for t in 0 to c_num_trafos - 1 loop | for t in 0 to c_num_trafos - 1 loop | ||
- | if s >= c_mode0_transparent_start_stroke_index - 1 then | + | if s >= c_mode0_transparent_start_stroke_index - 1 then -- Liveanzeige Klemmpuls frühestens ab Takt 13! |
led_rows_red(t) | led_rows_red(t) | ||
led_rows_green(t) <= clamp_pulses(t); | led_rows_green(t) <= clamp_pulses(t); | ||
Line 124: | Line 136: | ||
end if; | end if; | ||
-- display mode in lowest row | -- display mode in lowest row | ||
- | for m in 0 to c_num_measurement_ranges - 1 loop | + | for m in 0 to c_num_measurement_ranges - 1 loop -- Alle sieben möglichen Spalten... |
if s = m or s = 6 + m then | if s = m or s = 6 + m then | ||
if mode = to_unsigned(m, | if mode = to_unsigned(m, | ||
Line 133: | Line 145: | ||
end if; | end if; | ||
end loop; | end loop; | ||
- | if s = 5 or s = 6 + 5 then | + | if s = 5 or s = 6 + 5 then |
- | if mode = to_unsigned(6, | + | if mode = to_unsigned(6, |
led_rows_green(c_num_led_rows - 1) <= ' | led_rows_green(c_num_led_rows - 1) <= ' | ||
elsif preselected_mode = to_unsigned(6, | elsif preselected_mode = to_unsigned(6, | ||
- | led_rows_green(c_num_led_rows - 1) <= blink_signal; | + | led_rows_green(c_num_led_rows - 1) <= blink_signal; |
end if; | end if; | ||
end if; | end if; | ||
Line 173: | Line 185: | ||
-- debounce switches | -- debounce switches | ||
for i in 0 to c_rotary_switch_wl - 1 loop | for i in 0 to c_rotary_switch_wl - 1 loop | ||
- | debounce_array(i)(0) <= rotary_switch(i); | + | debounce_array(i)(0) <= rotary_switch(i); |
for d in 1 to c_debounce_time_ms - 1 loop | for d in 1 to c_debounce_time_ms - 1 loop | ||
- | debounce_array(i)(d) <= debounce_array(i)(d - 1); | + | debounce_array(i)(d) <= debounce_array(i)(d - 1); -- Schaltergeschichte bis vor 4ms |
end loop; | end loop; | ||
if debounce_array(i) = (c_debounce_time_ms - 1 downto 0 => ' | if debounce_array(i) = (c_debounce_time_ms - 1 downto 0 => ' |