Découvrez notre Chaîne YouTube "Ingénierie et Projets"
Découvrez notre Chaîne Secondaire "Information Neuronale et l'Ingénierie du Cerveau"

Projet électronique FPGA Gestion de l'afficheur 7 ségments schéma 1

Projet électronique PFGA 3 Génerateur des horloges montage 1

Projet électronique PFGA 3 Génerateur des horloges RTL

Objectifs du projet

  1. Comprendre le principe de diviseur de fréquence
  2. Savoir calculer le nombre des bits du compteur et la valeur de chargement
  3. Se familiariser avec un système multi-horloges
  4. Utilisation d’un décodeur BCD to BCD 7 Segments
  5. Autres astuces de programmation

Analyse de fonctionnement

Le circuit permet de générer une multitude des horloges allant de 6 MHz à 1 Hz, 8 horloges en total.

L’horloge de 1Hz (période d’une seconde) Contrôle l’afficheur 7 segments allant de 0 à 10 équivalents à une horloge de 10 secondes, un autre projet sera étudier prochainement pour créer une montre à 3 digits (9 :99).

Le circuit possède une entrée de réinitialisation RST et une entrée de validation CE (CE=’1’), lorsque CE=’0’, le système mémorise l’état actuel, CE=’1’ le système continue le fonctionnement à partir de l’état précédente.

8 LED d’état sont liés avec les horloges. Les trois afficheurs sont actifs en permanent par les signaux, donc la même valeur s’affiche partout.

Les sorties du compteur et la fréquence équivalente

 On considère un compteur sur 24 bits[0..23], le tableau ci-dessous montre la fréquence de chaque sortie avec F0=12MHz :

Sortie Rapport de division Fréquence (MHz)
0 2 6
1 1/4 3
2 1/8 1.5
3 1/16 0.75
4 1/32 0.375
5 1/64 0.1875
6 1/128  0.0938
7 1/256 0. 0469
23 1/16777216  0.7153 e-6

Calcul de la valeur du compteur et le nombre de bit en fonction de la fréquence désirée

La fréquence interne du kit kit de développement Elbert V2 (clk)  est liée à la fréquence 12 Mhz (voir le guide):

Projet électronique PFGA 3 Génerateur des horloges clk

F_clk= 12Mhz  => T0 = 1/F_clk = 83.33 ns. Pour obtenir une fréquence de Fx=1/Tx , il faut compter Nx période de T0, donc :

Tx = Nx * T0 => Nx = Tx/T0 = Tx*F0= F0/(2*Fx) avec un rapport de deux pret.

Ex : Pour obtenir une horloge de 1Hz (Fx=1Hz) : Nx = F0/(2*Fx)=12e6/2 =6.000.000 période de 83.33 ns

Calculer le nombre des bits du compteur

Pour savoir le nombre des bits, il suffit de convertir la valeur décimal en héxadécimal, le nombre des bits égal à la longeur du mot

Ex : 16e = 0x »5B8D80″ = b’10110111000110110000000′, donc le nombre des bits égal à 23 bits !

Site pour convertir un nombre décimal en Héxa ou binaire : click içi 

 Programme VHDL

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.numeric_std;


entity ClkGen is

        GENERIC
   (
      N : positive :=24;
                M : positive :=8
   );

    Port ( clk_12M         : in  STD_LOGIC;
           CE                         : in  STD_LOGIC:='0';
           RST                 : in  STD_LOGIC:='0';

                          Clk_6M         : out  STD_LOGIC :='0'; -- 6MHz
                          Clk_3M         : out  STD_LOGIC :='0'; -- 3MHz
                          Clk_750k         : out  STD_LOGIC :='0'; -- 750KHz
                          Clk_1P46k : out  STD_LOGIC :='0'; -- 1.46KHz
                          Clk_22P88 : out  STD_LOGIC :='0'; -- 22.88Hz
                          Clk_11P44 : out  STD_LOGIC :='0'; -- 11.44Hz
                          Clk_2P86        : out  STD_LOGIC :='0'; -- 2.86Hz

                          Clk_1_HZ         : out STD_LOGIC :='0' ;
                          Seg_value : out std_logic_vector(M-1 downto 0):=x"3F";
                          TransEN1        : out STD_LOGIC :='0' ;
                          TransEN2        : out STD_LOGIC :='0' ;
                          TransEN3        : out STD_LOGIC :='0'


                          );
end ClkGen;

architecture Beh_ClkGen of ClkGen is

SIGNAL         Count_tmp : std_logic_vector(N-1 downto 0):= x"000000";
SIGNAL         Count_1_sec : std_logic_vector(N-1 downto 0):= x"000000";
CONSTANT Value_1_sec : std_logic_vector(N-1 downto 0):= x"5B8D80"; -- = F0/2 dec2hex(12e6/2)(matlab)
SIGNAL         Clk_1_HZ_tmp : std_logic:='0';


SIGNAL         sel : std_logic_vector(3 downto 0):=x"0";
SIGNAL         Seg_temp : std_logic_vector(M-1 downto 0):=x"FF";
TYPE                 T_DATA is array (0 to 9) of std_logic_vector(M-1 downto 0);

-- Anode commune
CONSTANT SEG_7 : T_DATA :=

            (x"C0",  -- '0'
                                 x"F9",  -- '1'
             x"A4",  -- '2'
             x"B0",  -- '3'
             x"99",  -- '4'
                                 x"92",  -- '5'
                                 x"82",  -- '6'
                                 x"F8",  -- '7'
                                 x"80",  -- '8'
                                 x"90"); -- '9'


BEGIN

-- BCD TO 7 SEG CONVERTER

        PROCESS (Clk_1_HZ_tmp,sel,RST)
                BEGIN
                        IF RST = '1' THEN
                                Seg_temp <= x"00";
                        ELSIF (Clk_1_HZ_tmp'EVENT AND Clk_1_HZ_tmp='1') THEN
                                CASE sel IS
                                        WHEN x"0" => Seg_temp<=SEG_7(0);
                                        WHEN x"1" => Seg_temp<=SEG_7(1);
                                        WHEN x"2" => Seg_temp<=SEG_7(2);
                                        WHEN x"3" => Seg_temp<=SEG_7(3);
                                        WHEN x"4" => Seg_temp<=SEG_7(4);
                                        WHEN x"5" => Seg_temp<=SEG_7(5);
                                        WHEN x"6" => Seg_temp<=SEG_7(6);
                                        WHEN x"7" => Seg_temp<=SEG_7(7);
                                        WHEN x"8" => Seg_temp<=SEG_7(8);
                                        WHEN x"9" => Seg_temp<=SEG_7(9);
                                        WHEN OTHERS => Seg_temp<=SEG_7(0);
                                END CASE ;
                   END IF;
        END PROCESS;

        Seg_value<=Seg_temp;
        TransEN1<= '0';
        TransEN2<= '0';
        TransEN3<= '0';

-- Process de controle de l'afficheur 7 Segs : Incrémentation chaque séconde
-- de la valeur de sélection [Horloge 0-9 seconde]
        PROCESS (Clk_1_HZ_tmp, RST,CE)
                BEGIN
                 IF RST ='1' THEN
                        sel <= x"0";
                 ELSIF (Clk_1_HZ_tmp'EVENT AND Clk_1_HZ_tmp='1') THEN
                        IF CE ='1' THEN
                                sel<= sel + 1 ;
                                IF sel = x"9" THEN
                                        sel<= x"0";
                                END IF ;
                        ELSE
                                sel<=sel;
                        END IF;
                 END IF ;
        END PROCESS;


-- Génerateur des clocks de 6 MHh ----> 11Hz

        PROCESS (clk_12M, RST,CE)
                BEGIN
                 IF RST ='1' THEN
                        Count_tmp <= x"000000"; --(others =>'0')
                 ELSIF (clk_12M'EVENT AND clk_12M='1') THEN
                        IF CE ='1' THEN
                                Count_tmp<= Count_tmp + 1 ;
                        ELSE
                                Count_tmp<=Count_tmp;
                        END IF;
                 END IF ;
        END PROCESS;


        Clk_6M<= Count_tmp(0);
        Clk_3M<= Count_tmp(1);
        Clk_750k<= Count_tmp(3);
        Clk_1P46k<= Count_tmp(12); -- 1.46KHz
        Clk_22P88<= Count_tmp(18); -- 22.88Hz
        Clk_11P44<= Count_tmp(19); -- 11.44Hz
        Clk_2P86<= Count_tmp(N-2); -- 2.86Hz

-- Génerateur d'une horloge de 1 Hz : Horloge de l'afficheur 7 Seg
        SEC_1 : PROCESS (clk_12M, RST,CE)
                BEGIN
                 IF RST ='1' THEN
                        Count_1_sec <= x"000000";
                        Clk_1_HZ_tmp<='0';
                 ELSIF (clk_12M'EVENT AND clk_12M='1') THEN
                        IF CE ='1' THEN
                                Count_1_sec<= Count_1_sec + 1 ;
                                IF Count_1_sec = Value_1_sec THEN
                                        Count_1_sec <= x"000000";
                                        Clk_1_HZ_tmp<= not(Clk_1_HZ_tmp);
                           END IF ;
                        ELSE
                                Count_1_sec<=Count_1_sec;
                        END IF;
                 END IF ;
        END PROCESS;

        Clk_1_HZ <= Clk_1_HZ_tmp;

end Beh_ClkGen;

Fichier Pinout

CONFIG VCCAUX = "3.3" ;
# Clock 12 MHz
NET "clk_12M"                  LOC = P129  | IOSTANDARD = LVCMOS33 | PERIOD = 12MHz;
#NET "Clk"                     LOC = P57   | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;


    NET "Clk_6M"                        LOC = P46   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_3M"                        LOC = P47   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_750k"                      LOC = P48   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_1P46k"                     LOC = P49   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_22P88"                     LOC = P50   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_11P44"                     LOC = P51   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Clk_2P86"                      LOC = P54   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;

    NET "Clk_1_HZ"                      LOC = P55   | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;


    # DP SWITCH
    NET "CE"                       LOC = P70   | PULLUP  | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
    NET "RST"                      LOC = P69   | PULLUP  | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;


    NET "Seg_value[0]"    LOC = P117  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[1]"    LOC = P116  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[2]"    LOC = P115  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[3]"    LOC = P113  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[4]"    LOC = P112  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[5]"    LOC = P111  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[6]"    LOC = P110  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "Seg_value[7]"    LOC = P114  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;

    NET "TransEN1"        LOC = P124  | IOSTANDARD = LVCMOS33 | SLEW = FAST | DRIVE = 12;
    NET "TransEN2"        LOC = P121  | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;
    NET "TransEN3"        LOC = P120  | IOSTANDARD = LVCMOS33 | SLEW = SLOW | DRIVE = 12;

 Programme de simulation (Testbanch)

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY ClkGen_Test IS
END ClkGen_Test;

ARCHITECTURE behavior OF ClkGen_Test IS

    -- Component Declaration for the Unit Under Test (UUT)

    COMPONENT ClkGen
    PORT(
         clk_12M : IN  std_logic;
         CE : IN  std_logic;
         RST : IN  std_logic;
         Clk_6M : OUT  std_logic;
         Clk_3M : OUT  std_logic;
         Clk_750k : OUT  std_logic;
         Clk_1P46k : OUT  std_logic;
         Clk_22P88 : OUT  std_logic;
         Clk_11P44 : OUT  std_logic;
                        Clk_1_HZ : OUT  std_logic
        );
    END COMPONENT;


   --Inputs
   signal clk_12M : std_logic := '0';
   signal CE : std_logic := '0';
   signal RST : std_logic := '0';

         --Outputs
   signal Clk_6M : std_logic;
   signal Clk_3M : std_logic;
   signal Clk_750k : std_logic;
   signal Clk_1P46k : std_logic;
   signal Clk_22P88 : std_logic;
   signal Clk_11P44 : std_logic;
        signal Clk_1_HZ : std_logic;

   -- Clock period definitions
   constant clk_12M_period : time := 83.33333333333333333333        ns;

BEGIN

        -- Instantiate the Unit Under Test (UUT)
   uut: ClkGen PORT MAP (
          clk_12M => clk_12M,
          CE => CE,
          RST => RST,
          Clk_6M => Clk_6M,
          Clk_3M => Clk_3M,
          Clk_750k => Clk_750k,
          Clk_1P46k => Clk_1P46k,
          Clk_22P88 => Clk_22P88,
          Clk_11P44 => Clk_11P44,
                         Clk_1_HZ => Clk_1_HZ
        );

   -- Clock process definitions
   clk_12M_process :process
   begin
                clk_12M <= '0';
                wait for clk_12M_period/2;
                clk_12M <= '1';
                wait for clk_12M_period/2;
   end process;

        RST<='0';
        CE <='1';

END;

Projet électronique PFGA 3 Génerateur des horloges sim 1

Projet électronique PFGA 3 Génerateur des horloges sim 2

 Photos du projet

Projet électronique PFGA 3 Génerateur des horloges photo (1)

Projet électronique PFGA 3 Génerateur des horloges photo (2)

 

Un petit commentaire de vous, un Grand encouragement pour nous 🙂

– Bon Courage –

Click to rate this post!
[Total: 2 Average: 3]

1 commentaire

Projet électronique FPGA 5 : Générateur des signaux #V1 – Électronique Mixte · 2018-06-12 à 9:05

[…] pouvez consulter le projet électronique FPGA 3 : Générateur des horloges. Le circuit permet de générer une multitude des horloges allant de 6 MHz à 1 Hz, 8 horloges en […]

Laisser un commentaire

Avatar placeholder

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Anti-Robot *

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners.
Cookies settings
Accept
Decline
Privacy & Cookie policy
Privacy & Cookies policy
Cookie name Active

Privacy Policy

What information do we collect?

We collect information from you when you register on our site or place an order. When ordering or registering on our site, as appropriate, you may be asked to enter your: name, e-mail address or mailing address.

What do we use your information for?

Any of the information we collect from you may be used in one of the following ways: To personalize your experience (your information helps us to better respond to your individual needs) To improve our website (we continually strive to improve our website offerings based on the information and feedback we receive from you) To improve customer service (your information helps us to more effectively respond to your customer service requests and support needs) To process transactions Your information, whether public or private, will not be sold, exchanged, transferred, or given to any other company for any reason whatsoever, without your consent, other than for the express purpose of delivering the purchased product or service requested. To administer a contest, promotion, survey or other site feature To send periodic emails The email address you provide for order processing, will only be used to send you information and updates pertaining to your order.

How do we protect your information?

We implement a variety of security measures to maintain the safety of your personal information when you place an order or enter, submit, or access your personal information. We offer the use of a secure server. All supplied sensitive/credit information is transmitted via Secure Socket Layer (SSL) technology and then encrypted into our Payment gateway providers database only to be accessible by those authorized with special access rights to such systems, and are required to?keep the information confidential. After a transaction, your private information (credit cards, social security numbers, financials, etc.) will not be kept on file for more than 60 days.

Do we use cookies?

Yes (Cookies are small files that a site or its service provider transfers to your computers hard drive through your Web browser (if you allow) that enables the sites or service providers systems to recognize your browser and capture and remember certain information We use cookies to help us remember and process the items in your shopping cart, understand and save your preferences for future visits, keep track of advertisements and compile aggregate data about site traffic and site interaction so that we can offer better site experiences and tools in the future. We may contract with third-party service providers to assist us in better understanding our site visitors. These service providers are not permitted to use the information collected on our behalf except to help us conduct and improve our business. If you prefer, you can choose to have your computer warn you each time a cookie is being sent, or you can choose to turn off all cookies via your browser settings. Like most websites, if you turn your cookies off, some of our services may not function properly. However, you can still place orders by contacting customer service. Google Analytics We use Google Analytics on our sites for anonymous reporting of site usage and for advertising on the site. If you would like to opt-out of Google Analytics monitoring your behaviour on our sites please use this link (https://tools.google.com/dlpage/gaoptout/)

Do we disclose any information to outside parties?

We do not sell, trade, or otherwise transfer to outside parties your personally identifiable information. This does not include trusted third parties who assist us in operating our website, conducting our business, or servicing you, so long as those parties agree to keep this information confidential. We may also release your information when we believe release is appropriate to comply with the law, enforce our site policies, or protect ours or others rights, property, or safety. However, non-personally identifiable visitor information may be provided to other parties for marketing, advertising, or other uses.

Registration

The minimum information we need to register you is your name, email address and a password. We will ask you more questions for different services, including sales promotions. Unless we say otherwise, you have to answer all the registration questions. We may also ask some other, voluntary questions during registration for certain services (for example, professional networks) so we can gain a clearer understanding of who you are. This also allows us to personalise services for you. To assist us in our marketing, in addition to the data that you provide to us if you register, we may also obtain data from trusted third parties to help us understand what you might be interested in. This ‘profiling’ information is produced from a variety of sources, including publicly available data (such as the electoral roll) or from sources such as surveys and polls where you have given your permission for your data to be shared. You can choose not to have such data shared with the Guardian from these sources by logging into your account and changing the settings in the privacy section. After you have registered, and with your permission, we may send you emails we think may interest you. Newsletters may be personalised based on what you have been reading on theguardian.com. At any time you can decide not to receive these emails and will be able to ‘unsubscribe’. Logging in using social networking credentials If you log-in to our sites using a Facebook log-in, you are granting permission to Facebook to share your user details with us. This will include your name, email address, date of birth and location which will then be used to form a Guardian identity. You can also use your picture from Facebook as part of your profile. This will also allow us and Facebook to share your, networks, user ID and any other information you choose to share according to your Facebook account settings. If you remove the Guardian app from your Facebook settings, we will no longer have access to this information. If you log-in to our sites using a Google log-in, you grant permission to Google to share your user details with us. This will include your name, email address, date of birth, sex and location which we will then use to form a Guardian identity. You may use your picture from Google as part of your profile. This also allows us to share your networks, user ID and any other information you choose to share according to your Google account settings. If you remove the Guardian from your Google settings, we will no longer have access to this information. If you log-in to our sites using a twitter log-in, we receive your avatar (the small picture that appears next to your tweets) and twitter username.

Children’s Online Privacy Protection Act Compliance

We are in compliance with the requirements of COPPA (Childrens Online Privacy Protection Act), we do not collect any information from anyone under 13 years of age. Our website, products and services are all directed to people who are at least 13 years old or older.

Updating your personal information

We offer a ‘My details’ page (also known as Dashboard), where you can update your personal information at any time, and change your marketing preferences. You can get to this page from most pages on the site – simply click on the ‘My details’ link at the top of the screen when you are signed in.

Online Privacy Policy Only

This online privacy policy applies only to information collected through our website and not to information collected offline.

Your Consent

By using our site, you consent to our privacy policy.

Changes to our Privacy Policy

If we decide to change our privacy policy, we will post those changes on this page.
Save settings
Cookies settings

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

FPGA | Arduino | Matlab | Cours will use the information you provide on this form to be in touch with you and to provide updates and marketing.