[VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)
Répondre à la discussion
Affichage des résultats 1 à 3 sur 3

[VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)



  1. #1
    Baboush93

    Post [VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)


    ------

    Bonjour,

    Je dispose d'une carte contenant 16 "pixels" avec 3 leds (rouge, vert et bleu) par pixel ainsi que d'un XC2C128 VQ100.

    Le but est de créer diverses animations, changer de couleurs etc...

    Je souhaiterais dans un premier temps découper mes 48 leds en pack de 3 pour former 16 pixels que je commanderais par la suite.

    J'ai donc dans mon VHDL ma sortie STD_LOGIC_VECTOR (47 DOWNTO 0) et mon horloge en entrée.

    Ce que j'aimerais faire c'est "modifier" mes sorties pour ne plus avoir 48 leds à commander mais 16 packs de leds.

    Le problème c'est que je n'ai aucune idée sur quoi partir pour commencer mon code

    J'ai pensez créer un signal pixel par exemple (15 downto 0) puis faire des tableaux (16).

    Par exemple:

    Code:
    signal pixel : STD_LOGIC_VECTOR (15 downto 0);
    type table is array (0 to 15) of std_logic_vector (47 downto 0);
    constant pixel_table : table := (
    
    				"000 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111",
    
    				"111 000 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111
    				 111 111 111 111 111 111 111 111",
    .... x16 pour chaque pixel
    
    Begin
    
    pixel <= pixel_table;
    pixel(0) aura la table 1, pixel(2) aura la table 2 etc... jusqu'a 16 afin de ne plus manipuler led(0),led(1) jusqu'à 47 mais pixel(0),pixel(1) etc... jusqu'à 15

    Ce code est faux, il y aura plein d'erreur, mais c'est la seul façon que j'ai trouvé pour expliquer ce que je cherche à réaliser. De plus il y aura surment des problèmes si j'allume 2 pixels en même temps avec cette idée.

    Ou sinon créer mon signal pixel, puis faire 16x:
    pixel(0) <= not(led(0)) AND not(led(1)) AND not(led(2));
    etc...

    Pourriez-vous me donner un petit coups de pouce ?

    Je vous en remercie

    PS: mes leds s'allume à l'état bas, j'ai toutes les infos du mapping des leds sur les I/O du CPLD.

    -----
    Dernière modification par Baboush93 ; 14/04/2012 à 19h13.

  2. #2
    Baboush93

    Re : [VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)

    Je reviens vers vous avec une base de code:

    J'ai 2 codes VHDL:

    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
    
    entity damier16x3 is
        Port ( CLK : in  STD_LOGIC;
               LED0 : out  STD_LOGIC_VECTOR (47 downto 0));
    end damier16x3;
    
    architecture Behavioral of damier16x3 is
    
    begin
    
    LED0 <= (OTHERS => '1');
    
    end Behavioral;
    Le code de base de ma matrice avec 48 leds.

    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
    
    entity pixel is
        Port ( CLK : in  STD_LOGIC;
               led : in  STD_LOGIC_VECTOR (47 downto 0);
               PIXEL : out  STD_LOGIC_VECTOR (15 downto 0));
    end pixel;
    
    architecture Behavioral of pixel is
    
    begin
    
    pixel(0) <= not(led(0)) and not(led(1)) and not(led(2));
    pixel(1) <= not(led(3)) and not(led(4)) and not(led(5));
    pixel(2) <= not(led(6)) and not(led(7)) and not(led(8));
    pixel(3) <= not(led(9)) and not(led(10)) and not(led(11));
    pixel(4) <= not(led(12)) and not(led(13)) and not(led(14));
    pixel(5) <= not(led(15)) and not(led(16)) and not(led(17));
    pixel(6) <= not(led(18)) and not(led(19)) and not(led(20));
    pixel(7) <= not(led(21)) and not(led(22)) and not(led(23));
    pixel(8) <= not(led(24)) and not(led(25)) and not(led(26));
    pixel(9) <= not(led(27)) and not(led(28)) and not(led(29));
    pixel(10) <= not(led(30)) and not(led(31)) and not(led(32));
    pixel(11) <= not(led(33)) and not(led(34)) and not(led(35));
    pixel(12) <= not(led(36)) and not(led(37)) and not(led(38));
    pixel(13) <= not(led(39)) and not(led(40)) and not(led(41));
    pixel(14) <= not(led(42)) and not(led(43)) and not(led(44));
    pixel(15) <= not(led(45)) and not(led(46)) and not(led(47));
    
    
    end Behavioral;
    Le code ou je divise mes leds en pixels.

    Code:
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;
    
    entity final is
       port ( H   : in    std_logic; 
              PIX : out   std_logic_vector (15 downto 0));
    end final;
    
    architecture BEHAVIORAL of final is
       signal XLXN_5 : std_logic_vector (47 downto 0);
       component damier16x3
          port ( CLK  : in    std_logic; 
                 LED0 : out   std_logic_vector (47 downto 0));
       end component;
       
       component pixel
          port ( CLK   : in    std_logic; 
                 LED   : in    std_logic_vector (47 downto 0); 
                 PIXEL : out   std_logic_vector (15 downto 0));
       end component;
       
    begin
       XLXI_1 : damier16x3
          port map (CLK=>H,
                    LED0(47 downto 0)=>XLXN_5(47 downto 0));
       
       XLXI_2 : pixel
          port map (CLK=>H,
                    LED(47 downto 0)=>XLXN_5(47 downto 0),
                    PIXEL(15 downto 0)=>PIX(15 downto 0));
    					 
    pix(0) <= H;
    end BEHAVIORAL;
    Ici j'ai mon interconnexion entre mes deux codes précédent, la je veux que le pixel n°1 suivent l'horloge.

    Sa compile bien, le problème, c'est que dans ma simulation, l’état de pix(0) passe à X:
    Nom : simu.JPG
Affichages : 157
Taille : 96,0 Ko

    D'ou cela peut-il venir ?

    Merci

  3. #3
    Baboush93

    Re : [VHDL] - Commander une matrice de leds 16x3, besoin d'aide :)

    Super ce forum ... très utile ...
    Pas la peine de répondre j'ai fini ce que je voulais faire, fallait juste sortir un papier et un stylo et tout poser à plat.

Discussions similaires

  1. besoin d'aide Plexiglas + leds
    Par invitee21376e0 dans le forum Électronique
    Réponses: 2
    Dernier message: 03/03/2011, 13h59
  2. VHDL : besoin d'aide !
    Par invite1af3caff dans le forum Logiciel - Software - Open Source
    Réponses: 3
    Dernier message: 08/05/2009, 11h11
  3. [Microbiologie] Besoin d'aide pour commander des milieux de culture !!!
    Par inviteb412111e dans le forum Biologie
    Réponses: 0
    Dernier message: 17/04/2008, 16h11
  4. Besoin d'aide en éléctronique....Leds IR :(
    Par invite8b234aad dans le forum Électronique
    Réponses: 5
    Dernier message: 09/12/2006, 21h57
  5. Besoin d'aide à propos de DELs (ou LEDs)
    Par invite9da23ab2 dans le forum Électronique
    Réponses: 7
    Dernier message: 22/05/2005, 14h41
Découvrez nos comparatifs produits sur l'informatique et les technologies.