Академический Документы
Профессиональный Документы
Культура Документы
Campus Pelotas
ENGENHARIA ELÉTRICA
SISTEMAS DIGITAIS
Integrantes:
Mikael Silva
Pelotas
2009
Resumo—Atualmente, umas das formas mais utilizadas de controle na
indústria é a PWM (Pulse Width Modulation), a qual se destina controlar um
circuito analógico por meio de um circuito digital. Existem basicamente duas
técnicas para esse procedimento: a conversão D/A (digital/analógica) e a
modulação por largura de pulso (PWM). Nosso projeto utilizará como base de
controle a técnica PWM.
I. INTRODUÇÃO
P=V x I (1).
Fig.6 Descrição do registrador “a” do código vhdl (pequeno trecho do código completo).
IV. METODOLOGIA
A. Especificação
B. Detalhamento do projeto
Aqui se pretende executar um detalhamento da estrutura interna do
projeto. Para isso devem ser criadas as estruturas do bloco operacional
e de controle bem como as conexões entre as interfaces utilizadas.
Fig. 10 Bloco de controle, juntamente com o bloco dos botões síncronos e diagrama FSMD
(anexo A).
X0 reset
0
reset’ clk
X1
j<b’ 0
inc
dec clk
clk
clk X5
X2 a>100 0
0 clk clk
a<0’
a<0 a>100’
clk clk
clk X6
clk
0
X3 X7
X9 X4
clk clk 0
1
0 0 clk
j<b dec’ and inc’
clk
X8 i<a
1
clk i<a’
2
O símbolo “ ‘ “, após as notações indica negação.
Estado atual Próximo estado Ação
reset’, x1 i=0; j=0; a=a; b=b; s=0;
x0
reset, x0 i=0; j=0; a=0; b=100; s=0;
inc, x5 i=0; j=0; a=a+10; b=100-a; s=0;
x1 dec’ and inc’, x7 i=i+1; j=0; a=a; b=1; s=0;
dec, x2 i=i; j=j; a=a-10; b=100-a; s=0
a<o’, x4 i=i; j=j+1; a=a; b=b; s=0
x2
a<o, x3 i=i; j=j; a=a; b=b; s=0
x3 x4 i=i; j=j+1; a=a; b=b; s=0
x4 j<b, x1 i=0; j=0; a=a; b=b; s=0;
a>100, x6 i=0; j=0; a=100; b=0; s=0;
x5
a>100’, x7 i=i+1; j=0; a=a; b=1; s=0;
x6 x7 i=i+1; j=0; a=a; b=1; s=0;
i<a, x8 i=i; j=0; a=a; b=b; s=1;
x7
i<a’, x4 i=i; j=j+1; a=a; b=b; s=0
x8 x7 i=i+1; j=0; a=a; b=1; s=0;
x9 x4 i=i; j=j+1; a=a; b=b; s=0
Tabela 1 Tabela de transição de estados.
V. RESULTADOS OBTIDOS
A simulação apresentou o comportamento esperado no que se refere aos
incrementos e decrementos dos valores dos registradores “a”, “b”, “i”, e “j”. A
largura do pulso de alta também obedeceu aos incrementos e decrementos
perfeitamente.
Na definição da largura do pulso de baixa, os registradores armazenaram
corretamente os valores, porém ao entrar no estado x4, ocorreu um “loop”
infinito com o estado x9. Dessa forma, não ocorreu a transição para o estado
x1 e, consequentemente, o nível alto na saída não se repetiu. Portanto, as
transições de estados, referente aos pulsos em nível alto, ocorreram
corretamente.
VI. CONSIDERAÇÕES FINAIS
Esta atividade se mostrou extremamente válida, especialmente no que
se refere ao desenvolvimento de um projeto com transferência entre
registradores (RTL).
[1] VAHID,Frank. Sistemas Digitais Projeto Otimização e HDLS.1 ed. São Paulo: Artmed, 2008. 560p.
Anexo A
--Sistemas Digitais
--Código vhdl para controle de luminosidade de led por controle pwm
library ieee;
use ieee.std_logic_1164.all;
--use ieee.numeric_std.all;
use ieee.std_logic_arith.all;
entity codigo2 is
port
(
clk : in std_logic;
reset : in std_logic;
inc : in std_logic;
dec : in std_logic;
s : out std_logic
);
end entity;
type algo_type is (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9);
type botao_inc_type is (ea,ac,el);
type botao_dec_type is (ae,ca,le);
begin
estado_botao_inc<=ac;
end if;
when ac=>
estado_botao_inc<=el;
when el=>
if inc='1' then
estado_botao_inc<=ea;
end if;
end case;
end if;
end process;
process(estado_botao_inc)
begin
if estado_botao_inc=ac then
s_inc<='1';
else s_inc<='0';
end if;
end process;
---------------------------------------------------------------------------
estado_botao_dec<=ca;
end if;
when ca=>
estado_botao_dec<=le;
when le=>
if dec='1' then
estado_botao_dec<=ae;
end if;
end case;
end if;
end process;
process(estado_botao_dec)
begin
if estado_botao_dec=ca then
s_dec<='1';
else s_dec<='0';
end if;
end process;
-----------------------------------------------------------------------------------
case(estado_para_algo) is
when x0 =>
estado_para_algo <= x1;
when x1=>
if s_inc = '1' then
estado_para_algo <= x5;
elsif s_dec='1' then
estado_para_algo <= x2;
elsif (s_dec='0'and s_inc='0') then
estado_para_algo <= x7;
else
estado_para_algo <= x1;
end if;
when x2=>
if (a<0) then --(a<0) (b>0)
estado_para_algo <= x3;
else
estado_para_algo <= x4;
end if;
when x3=>
estado_para_algo <= x4;
when x4=>
if (j<b) then
estado_para_algo <= x9;
else
estado_para_algo <= x1;
end if;
if s_dec='1' then estado_para_algo <= x2; end if;
when x5=>
if not (a(6) = '1' and a(5) = '1' and a(4) = '0' and
a(3) = '1') then --CONV_UNSIGNED(100,7)
estado_para_algo <= x7;
else
estado_para_algo <= x6;
end if;
when x6=>
estado_para_algo<= x7;
when x7=>
if i >= a then
estado_para_algo <= x4;
else
estado_para_algo <= x8;
end if;
if s_inc='1' then estado_para_algo <= x5; end if;
when x8=>
estado_para_algo <= x7;
when x9=>
estado_para_algo <= x4;
end case;
end if;
end process;
--processo para i:
process(clk)
begin
if clk'event and clk='1' then
if estado_para_algo = x0 or
estado_para_algo = x1 or
estado_para_algo = x2 or
estado_para_algo = x3 or
estado_para_algo = x5 or
estado_para_algo = x6 then
i<=CONV_UNSIGNED(0,7);
elsif estado_para_algo=x7 then
i<=i+CONV_UNSIGNED(1,7);
end if;
end if;
end process;
--processo para j:
process(clk)
begin
if clk'event and clk='1' then
if estado_para_algo=x0 or
estado_para_algo=x1 or
estado_para_algo=x2 or
estado_para_algo=x3 or
estado_para_algo=x5 or
estado_para_algo=x6 then
j<=CONV_UNSIGNED(0,7);
elsif estado_para_algo=x4 then
j<=j+CONV_UNSIGNED(1,7);
end if;
end if;
end process;
--processo para a:
process(clk)
begin
if clk'event and clk='1' then
if estado_para_algo= x0 or
estado_para_algo= x3 then
a<=CONV_UNSIGNED(0,7);
elsif estado_para_algo=x2 then
a<=a-CONV_UNSIGNED(10,7);
elsif estado_para_algo=x5 then
a<=a+CONV_UNSIGNED(10,7);
elsif estado_para_algo=x6 then
a<=CONV_UNSIGNED(100,7);
end if;
end if;
end process;
--processo para b:
process(clk)
begin
if clk'event and clk='1' then
if estado_para_algo = x0 then
b<=CONV_UNSIGNED(0,7); --
alterado para 100, era 0
elsif estado_para_algo=x2 then
b<=CONV_UNSIGNED(100,7)-a; --
b<=CONV_UNSIGNED(100,7)-a;b<=b+CONV_UNSIGNED(10,7);
elsif estado_para_algo=x3 then
b<=CONV_UNSIGNED(100,7);
end if;
end if;
end process;
process (estado_para_algo)
begin
case (estado_para_algo) is
when x0=>
s<='0';
when x1=>
s<='0';
when x2=>
s<='0';
when x3=>
s<='0';
when x4=>
s<='0';
when x5=>
s<='0';
when x6=>
s<='0';
when x7=>
s<='1';
when x8=>
s<='1';
when x9=>
s<='0';
end case;
end process;
end rtl;