source: firmware/FTM/Lightpulser_interface/Basic_Version/FM_pulse_generator_Basic.vhd@ 14788

Last change on this file since 14788 was 11513, checked in by vogler, 13 years ago
lightpulser interface modified to reduce LED current and light output
File size: 2.1 KB
Line 
1-- ----------------------------------------------------------------------------
2-------------------------------------------------------------------------------
3-- FTM Light pulser interface: FM__pulse generator for feedback
4-------------------------------------------------------------------------------
5--
6--
7-- Created: May 13 2011
8-- by Patrick Vogler
9--
10-- modified: May 26 2011
11-- by Patrick Vogler
12-- "Lightpulser Basic Version"
13--
14-- modified: May 27 2011
15-- by Patrick Vogler, Quirin Weitzel
16-- -> clean up
17--
18-- modified: July 20 2011
19-- by Patrick Vogler
20-- reduce LED current to reduce total light yield
21--
22
23
24LIBRARY ieee;
25USE ieee.std_logic_1164.all;
26USE ieee.std_logic_arith.all;
27USE ieee.std_logic_unsigned.all;
28
29
30library ftm_definitions;
31USE ftm_definitions.ftm_constants.all;
32
33
34ENTITY FM_pulse_generator_Basic IS
35 GENERIC(
36 pulse_length : integer := FLD_PULSE_LENGTH_FM -- 60ns
37 );
38 PORT(
39 clk : in std_logic;
40 pulse_freq : in std_logic_vector (6 downto 0);
41 FM_out : out std_logic := '0'
42 );
43END FM_pulse_generator_Basic;
44
45ARCHITECTURE beha OF FM_pulse_generator_Basic IS
46
47BEGIN
48
49 clk_div: process (clk)
50 variable Z : integer range - FLD_MIN_FREQ_DIV_BASIC to FLD_FD_MAX_RANGE_BASIC;
51 variable Y : integer range 0 to FLD_PULSE_LENGTH_FM;
52 variable X : integer range 0 to FLD_FD_MULT_BASIC ;
53
54 begin
55
56 if rising_edge(clk) then
57 if (X < FLD_FD_MULT_BASIC - 1) then
58 X := X+1;
59 else
60 X := 0;
61 if (Z < pulse_freq) then
62 Z := Z + 1;
63 else
64 Z := - FLD_MIN_FREQ_DIV_BASIC + 1;
65 Y := 0;
66 end if;
67 end if;
68
69 if (Y < pulse_length) then
70 Y := Y + 1;
71 FM_out <= '1';
72 else
73 FM_out <= '0';
74 end if;
75
76 end if;
77 end process clk_div;
78
79END ARCHITECTURE beha;
Note: See TracBrowser for help on using the repository browser.