User Tools

Site Tools


projects:maps21:s:dcont:code:cpld2:cpld2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
projects:maps21:s:dcont:code:cpld2:cpld2 [2024/05/09 20:18]
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  ^  Constante  ^^ +^ Varable  ^  Constante  ^^ 
-| s = "1ms-Takte" ^ c_num_trafos ✔  | = Trafoanzahl = 8  | +| s = "1ms-Takte"c_num_trafos ✔  | = Trafoanzahl = 8  | 
-| t = Trafoindex Laufvariabel  ^ c_stroke_wl ✔ | = Länge Bitstring[4..0] = 5 |  +| t = Trafoindex Laufvariabel c_stroke_wl ✔ | = Länge Bitstring[4..0] = 5 |  
-| r = Reihe/Spalte d. Anzeige Laufvariabel  |   |  +| r = Reihe/Spalte d. Anzeige Laufvariabel |   |  
-| m = Laufvariable Stelle im Bitstring stroke  ^ c_mode_wl ✔ | = Länge Bitstring Mode[1..0] = 3  | +| m = Laufvariable Stelle im Bitstring stroke c_mode_wl ✔ | = Länge Bitstring Mode[2..0] = 3  | 
-| **trafosignals[5..0]** Bitstring[5..0] (<color green>RRR</color><color red>T</color><color #DDDD55>K</color><color green>P</color>  ^ c_knob_select_wl ✘ | = Länge Dekoder Bitstring[1..0] = 2  | +| **trafosignals[5..0]** Bitstring[5..0] (<color green>RRR</color><color red>T</color><color #DDDD55>K</color><color green>P</color> c_knob_select_wl ✘ | = Länge Dekoder Bitstring[1..0] = 2  | 
-| **Stroke[4..0]** = Bitstring[4..0] Eingangsvariable 1ms-Takt  ^ c_measurement_range_wl ✔  | = Länge Bitstring der Balkenanzeige = 7  | +| **Stroke[4..0]** = Bitstring[4..0] Eingangsvariable 1ms-Takt c_measurement_range_wl ✔  | = Länge Bitstring der Balkenanzeige = 7  | 
-| **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  | 
-|  ^ 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  ^ c_num_led_columns  | = Anzahl der Spalten[6..0]   | +| **led_columns(t)** = sieben Spalten c_num_led_columns  | = Anzahl der Spalten[6..0]   | 
-| **led_rows_red(t)** = zehn Zeilen rot  ^  |  | +| **led_rows_red(t)** = zehn Zeilen rot  ^  |  | 
-| **led_rows_green(t)** = zehn Zeilen green  ^  |  | +| **led_rows_green(t)** = zehn Zeilen green  ^ |  | 
-| rotary_switch_debounced  ^ c_rotary_switch_wl  | = Länge Kodiererstring = 3  | +| rotary_switch_debounced c_rotary_switch_wl  | = Länge Kodiererstring = 3  | 
-| rotary_switch_debounced_d1  |  | +| rotary_switch_debounced_d1  ^ | c_mode0_transparent_start_stroke_index  | = 13 Intenger Beginn Anzeige Klemmpuls im 20ms Intervall 
-|  ^  |  | +|  ^  |  | 
-|  ^  |  | +|  ^  |  | 
-|  ^  |  | +|  ^  |  | 
-^ ^^^ +^^^^ 
-| p_drive_led_rows: Prozess LED-Treiber  ||| +<color /#DDFFDD>**p_debounce_and_handle_switches**</color>  |||| 
-p_debounce_and_handle_switches  ||| +| <color /#DDFFDD>**p_count**</color>  |||| 
- +| <color /#DDFFDD>**p_drive_led_rows: Prozess LED-Treiber**</color>  |||| 
 +<color /#DDFFDD>**p_drive_led_columns**</color>  |||
 + 
 ===== Code Orginal ===== ===== Code Orginal =====
  
Line 102: 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 <= '1';  blink_signal <= '1';
Line 124: Line 129:
  if mode <= to_unsigned(1, c_mode_wl) then  if mode <= to_unsigned(1, c_mode_wl) then
  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)   <= clamp_pulses(t); -- display clamp pulse in yellow  led_rows_red(t)   <= clamp_pulses(t); -- display clamp pulse in yellow
  led_rows_green(t) <= clamp_pulses(t);  led_rows_green(t) <= clamp_pulses(t);
Line 131: 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, c_mode_wl) then  if mode = to_unsigned(m, c_mode_wl) then
Line 140: 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  --Klemmpulstakt 
- if mode = to_unsigned(6, c_mode_wl) then+ if mode = to_unsigned(6, c_mode_wl) then. -- Entklemmt 9. Zeile
  led_rows_green(c_num_led_rows - 1) <= '1';  led_rows_green(c_num_led_rows - 1) <= '1';
  elsif preselected_mode = to_unsigned(6, c_mode_wl) then  elsif preselected_mode = to_unsigned(6, c_mode_wl) then
- led_rows_green(c_num_led_rows - 1) <= blink_signal;+ led_rows_green(c_num_led_rows - 1) <= blink_signal; -- Blinken in 7. Spalte
  end if;  end if;
  end if;  end if;
Line 180: 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); -- Aktuelles Schaltersignal
  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 => '0') then -- check for five consecutive equal signal states  if debounce_array(i) = (c_debounce_time_ms - 1 downto 0 => '0') then -- check for five consecutive equal signal states
projects/maps21/s/dcont/code/cpld2/cpld2.1715278720.txt.gz · Last modified: 2024/05/09 20:18 by carsten