Академический Документы
Профессиональный Документы
Культура Документы
1.
Introducci
on
Como conclusi
on del a
no, y utilizando los contenidos aprendidos, proponemos la realizaci
on de un proyecto en el que integraremos conceptos tales como
M
aquinas de Estado, comunicacion por Puerto Serie, Divisores de Frecuencia, y
dem
as, mediante su implementacion en VHDL describiendo una estructura de
hardware corriendo en una plataforma FPGA.
2.
Ante - Proyecto
3.
Adaptaci
on
Figura 1: M
odulo de interpretacion del codigo Morse.
4.
Realizaci
on
La construcci
on en VHDL se descompone en 2 modulos: la lectura de la
trama del mensaje y el envo por protocolo UART a la PC.
1. Para la interpretaci
on de la trama del mensaje construmos una maquina
de Mealy (Figura 1) cuya finalidad fue determinar si la se
nal que ingresaba
corresponda a un punto (.) o a una raya (-), componentes fundamentales del c
odigo Morse. Ademas de los puntos y rayas, la maquina deba
discriminar 2 lapsos de tiempo de diferente longitud, para poder, luego,
determinar cuales puntos y rayas deben ir juntos para simbolizar una letra
y cuales deben ir separados porque pertenecen a palabras diferentes.
2. Por otro lado, una vez realizada la identificacion del smbolo recibido, es
necesario enviarlo a la PC donde se realizara la vinculacion con los caracteres correspondientes -indicados por el modulo anterior- a fin de formar
el mensaje. Para esto, el modulo de transmision utiliza el protocolo UART
a 115200 baudios mediante el cual enva los paquetes con el mensaje.
4.1.
Problemas
smbolos. Cremos -y luego comprobamos- que mediante la utilizacion de tres indicadores se logra un dictado fluido. Dos de ellos se encargan de indicar cuando
se ha detectado un punto o una raya respectivamente y el tercero se
nala cuando
ha transcurrido el tiempo suficiente para indicar un espacio.
Otro imprevisto que se nos presento fue la sobrecarga del canal de comunicaciones, debido a que el sistema estaba dise
nado para enviar un codigo equivalente
a un espacio cada cierto intervalo de tiempo definido. Al estar el receptor en
estado IDLE, a la espera del ingreso del mensaje por parte del operador, este
enviaba constantemente espacios utilizando ociosamente la linea. Para solucio
narlo, limitamos la cantidad de envos a 2 espacios seguidos. Esta
es la mayor
separaci
on necesaria ya que es utilizada para denotar el desacople entre palabras.
5.
Conclusi
on
6.
Code
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
entity receptor is
generic(
frequency
baud
);
Port (
I,rst
clkCS
txd,clkCM
txd_busy
: integer := 25000000;
: integer := 115200
:
:
:
:
in STD_LOGIC;
in std_logic;
out std_logic;
out std_logic;
<=
<=
<=
<=
1;
0;
0;
0;
if (I = 0) then
S_i <= "00";
else
S_i <= "00";
end if;
end if;
if (stateCM = espacio) then
E1
E2
E3
E4
<=
<=
<=
<=
0;
1;
0;
0;
if (I = 0) then
S_i <= "11";
else
S_i <= "00";
end if;
end if;
if (stateCM = punto) then
E1
E2
E3
E4
<=
<=
<=
<=
0;
0;
1;
0;
if (I = 0) then
S_i <= "01";
else
S_i <= "10";
end if;
end if;
if (stateCM = ralla) then
E1
E2
E3
E4
<=
<=
<=
<=
0;
0;
0;
1;
if (I = 0) then
S_i <= "00";
else
S_i <= "00";
end if;
end if;
end process;
NEXT_STATE_DECODE: process (stateCM, I)
begin
next_stateCM <= stateCM; --default is to stay in current state
case (stateCM) is
when reposo =>
if I = 1 then
next_stateCM <= punto;
else
next_stateCM <= espacio;
end if;
when espacio =>
if I = 1 then
next_stateCM <= punto;
else
next_stateCM <= espacio;
end if;
when punto =>
if I = 1 then
next_stateCM <= ralla;
else
next_stateCM <= reposo;
end if;
when ralla =>
if I = 1 then
next_stateCM <= ralla;
else
next_stateCM <= reposo;
end if;
when others =>
next_stateCM <= reposo;
end case;
end process;
-- COMUNICACION SERIE
-- DEFINICIONES
txd_busy <= busy; busy <= 0 when stateCS = idle else 1;
-- PROCESOS
baud_gen : process(clkCS)
begin
if clkCSevent and clkCS = 1 then
if busy = 1 then
baud_divider <= baud_divider + (baud/100);
if baud_divider > (frequency/100) then
baud_tick <= 1;
baud_divider <= 0;
else
baud_tick <= 0;
end if;
end if;
end if;
end process baud_gen;
-state_proc : process(clkCS)
begin
if clkCSevent and clkCS = 1 then
case stateCS is
when idle =>
if txd_start = 1 then
stateCS <= start;
end if;
when start =>
if baud_tick = 1 then
stateCS <= bit0;
end if;
when bit0 =>
if baud_tick = 1 then
stateCS <= bit1;
end if;
when bit1 =>
if baud_tick = 1 then
stateCS <= bit2;
end if;
when bit2 =>
if baud_tick = 1 then
stateCS <= bit3;
end if;
when bit3 =>
if baud_tick = 1 then
stateCS <= bit4;
end if;
when bit4 =>
if baud_tick = 1 then
stateCS <= bit5;
end if;
when bit5 =>
if baud_tick = 1 then
stateCS <= bit6;
end if;
when bit6 =>
if baud_tick = 1 then
stateCS <= bit7;
end if;
when bit7 =>
if baud_tick = 1 then
stateCS <= stop1;
end if;
when stop1 =>
if baud_tick = 1 then
stateCS <= stop2;
end if;
when stop2 =>
if baud_tick = 1 then
end Behavioral;