1 / 102

Introducción a las Interfaces de entrada / salida

Introducción a las Interfaces de entrada / salida. Puerto de Salida Básico. Registro (Latch). #CE. CLK. #WR. #OE. D0 D7. Q0 Q7. Bus de Datos del Sistema. Salidas. Sintesis en vhdl de un puerto de salida. Entity Salida is port ( HCLK : in std_logic;

xenon
Download Presentation

Introducción a las Interfaces de entrada / salida

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introducción a las Interfaces de entrada / salida

  2. Puerto de Salida Básico Registro (Latch) #CE CLK #WR #OE D0 D7 Q0 Q7 Bus de Datos del Sistema Salidas

  3. Sintesis en vhdl de un puerto de salida Entity Salida is port ( HCLK : in std_logic; RESET : in std_logic; CS : in std_logic; WR : in std_logic; D : in std_logic_vector (7 downto 0); --Bus datos es siempre entrada O : out std_logic_vector (7 downto 0) --Salidas al exterior ); end Salida;

  4. architecture B2 of Salida is begin process (HCLK, RESET) begin if RESET = '1' then O ( 7 downto 0 )<= "00000000"; else if HCLK = '1' and HCLK'event then -- Flanco de ascendente if CS = '0' then if WR = '0' then O (7 downto 0) <= D ( 7 downto 0 ); end if; end if; end if; end if; end process; end B2;

  5. Estimulo para test del puerto de salida

  6. Simulación – Puerto de salida

  7. Puerto de Entrada Básico Puerta de 3 estados (Transceiver) #CE #RD #OE O0 O7 I0 I7 Bus de Datos del Sistema Entradas

  8. Sintesis en vhdl de un puerto de entrada entity Entrada is port ( HCLK : in std_logic; RESET : in std_logic; CS : in std_logic; RD : in std_logic; D : out std_logic_vector (7 downto 0); -- Bus Datos es siempre salida I : in std_logic_vector (7 downto 0) -- Entradas externas ); end Entrada;

  9. architecture B2 of Entrada is Begin process (HCLK, RESET) Begin if RESET = '1' then D ( 7 downto 0 )<= "ZZZZZZZZ"; else if HCLK = '1' and HCLK'event then -- Flanco de ascendente if CS = '0' then -- Acceso al registro solo si CS es 0 if RD = '0' then D ( 7 downto 0 ) <= I (7 downto 0); else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si RD esta en 1 el bus esta en "Z" end if; else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si CS esta en 1 el bus esta en "Z" end if; end if; end if; end process; end B2;

  10. Estimulo – Puerto de entrada

  11. Simulación – Puerto de entrada

  12. 8. 8. 8. 8. Aplicación Puerto “A” Q7 CE1 WL CLK Excitación (Ánodos) D7 … D0 OE Q0 Puerto “B” CE1 WH CLK K3 K2 K1 K0 D15 … D8 Q3 Q0 OE Habilitaciones (Cátodos)

  13. a f b g e c p d

  14. ÁNODOS CÁTODO COMÚN ÁNODOS

  15. Vcc a b c d e f g p CÁTODO COMÚN ÁNODOS

  16. ÁNODOS 5. 8. 8. 8. KHH KMH KML KLL ULN2003 1 0 0 0

  17. ÁNODOS 8. 8. 3. 8. KMH KML KLL ULN2003 0 1 0 0

  18. ÁNODOS 8. 9. 8. 8. KMH KML KLL ULN2003 0 0 1 0

  19. ÁNODOS 8. 8. 8. 6. KMH KML KLL ULN2003 0 0 0 1

  20. ;Subrutina DISP ;Variables utilizadas: ;STATUS : Próximo dígito de Buffer que es necesario refrescar ;BUFFER : Tabla de 8 bytes que contiene los datos para el display y los códigos de habilitación correspondientes STATUS dw 0 BUFFER db 1, 1 ;LSD , 00000001 db 3, 2 ; , 00000010 db 5, 4 ; , 00000100 db 7, 8 ;MSD; 00001000 ;PORT_A : Etiqueta que especifica la dirección del puerto del display PORT_A equ XXXX

  21. ;Subrutina DISP ;Variables utilizadas: ;STATUS : Próximo dígito de Buffer que es necesario refrescar ;BUFFER : Tabla de 8 bytes que contiene los datos para el display y los códigos de habilitación correspondientes STATUS dw 0 BUFFER db 1, 1 ;LSD , 00000001 db 3, 2 ; , 00000010 db 5, 4 ; , 00000100 db 7, 8 ;MSD; 00001000 ;PORT_A : Etiqueta que especifica la dirección del puerto del display PORT_A equ XXXX 0 STATUS 0 OFFSET incrementa 1 BUFFER 1 = 00000001 3 2 = 00000010 5 4 = 00000100 7 8 =00001000

  22. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN BUFFER MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET

  23. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN BUFFER MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET

  24. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN BUFFER MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET OFFSET BUFFER 1 1 = 00000001 3 STATUS 2 = 00000010 5 4 = 00000100 7 8 =00001000

  25. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN TRABLA MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET

  26. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN TRABLA MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET

  27. ;SUB. DE REFRESCO------------ DISP PROC NEAR XOR AX,AX MOV DX, PORT_A OUT DX,AX ;APAGA DISPLAY MOV BX, STATUS ;BUSCA DATOS EN TRABLA MOV SI, OFFSET BUFFER MOV AX,(BX+SI) OUT DX,AX ;ENCIENDE DIGITO ADD BX, 2 ;APUNTA AL PROXIMO DIGITO EN MEMORIA AND BX, 7 MOV STATUS,BX RET

  28. Teclado C0 C1 Entradas C2 C3 F0 F1 Teclas Salidas F2 F3

  29. TECLADO 0 0 Entradas 0 0 0 1 Salidas 0 0

  30. TECLADO 0 1 Entradas 0 0 0 1 Salidas 0 0

  31. TECLADO 0 0 Entradas 0 0 0 1 Salidas 0 0

  32. TECLADO 0 0 Entradas 0 0 0 1 Salidas 0 0

  33. Teclado C0 C1 Entradas C2 C3 F0 F1 Teclas Salidas F2 F3

  34. 8. 8. 8. 8. Aplicación Q7 CE1 WL CLK Excitación (Ánodos) D7 … D0 OE Q0 CE1 WH CLK K3 K2 K1 K0 D15 … D8 Q3 Q0 OE Habilitaciones (Cátodos)

  35. Teclado C0 C1 Entradas C2 C3 Q0 Q1 Teclas Q2 Q3

  36. Teclado I0 I1 Entradas I2 I3 P U E R T O B Q0 Q1 Teclas Q2 Q3

  37. PUERTO_C Puerta de 3 estados CE OE1 RDL OE2 Entradas D0 D7 O0 O7 I0 I7

  38. Teclado I3 I2 I1 I0 I4 I5 I6 I7 Entradas PUERTO_C P U E R T O B Q0 Q1 Teclas Q2 Q3

  39. Subrutina SCAN : Variables utilizadas : TECLA : Código ultima tecla presionada TECLA db 0 ;SUB. DE EXPLORACION DE TECLADO SCAN PROC NEAR MOV DX, PORT_B IN AL, DX TEST AL, 0F0h JZ notec MOV TECLA, AL notec: RET

  40. Registros internos Síntesis en vhdl de un registro interno (sin líneas de entrada ni salida) entity Registro is port ( HCLK : in std_logic; RESET : in std_logic; CS : in std_logic; RD : in std_logic; WR : in std_logic; D : inout std_logic_vector (7 downto 0) -- Bus de datos es Entrada/Salida ); end Registro;

  41. architecture B2 of Registro is Begin process (HCLK, RESET) variable REGISTRO : std_logic_vector (7 downto 0) := "00000000"; Begin if RESET = '1' then D ( 7 downto 0 )<= "ZZZZZZZZ"; else if HCLK = '1' and HCLK'event then -- Flanco de ascendente if CS = '0' then -- Acceso al registro solo si CS es 0 if RD = '0' then D ( 7 downto 0 ) <= REGISTRO (7 downto 0); else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si RD = 1, bus en "Z" if WR = '0' then REGISTRO (7 downto 0) := D ( 7 downto 0 ); end if; end if; else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si CS = 1, bus en "Z" end if; end if; end if; end process; end B2;

  42. Estímulo para test de registro interno

  43. Salida del test de registro interno

  44. Generador PWM Contador Comparador HCLK CLK Q0 Q7 Salida PWM =1 si Registro > Contador Registro #CE #WR #OE CLK D0 D7 Q0 Q7 Bus de Datos del Sistema

  45. Síntesis VHDL de Generador PWM entity PWM is port ( HCLK : in std_logic; RESET : in std_logic; CS : in std_logic; RD : in std_logic; WR : in std_logic; D : inout std_logic_vector (7 downto 0); PWM : out std_logic ); end PWM;

  46. architecture B2 of PWM is Begin process (HCLK, RESET) variable REGISTRO : std_logic_vector (7 downto 0) := "00000000"; variable CICLO : std_logic_vector (7 downto 0) := "00000000"; variable CONTADOR : std_logic_vector (7 downto 0) := "00000000"; Begin if RESET = '1' then D ( 7 downto 0 )<= "ZZZZZZZZ"; PWM <= '0'; else if HCLK = '1' and HCLK'event then -- Flanco de ascendente if CS = '0' then -- Acceso al registro solo si CS es 0 if RD = '0' then D ( 7 downto 0 ) <= REGISTRO (7 downto 0); else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si RD es 1 el bus es "Z" if WR = '0' then REGISTRO (7 downto 0) := D ( 7 downto 0 ); end if; end if; else D ( 7 downto 0 ) <="ZZZZZZZZ"; -- Si CS es 1 el bus es "Z" end if;

  47. CONTADOR := CONTADOR +1; if CONTADOR > CICLO then PWM <= '0'; else PWM <= '1'; end if; if CONTADOR = "00000000" then CICLO := REGISTRO; end if; end if; end process; end B2;

  48. Test de puerto PWM

  49. Puertos programables, líneas de control Puerto de Entrada + Salida Básico #CE Registro (Latch) #WR #OE Salida Bus de Datos Entrada Puerta de 3 estados (Transceiver) #RD #OE

  50. Puertos programables, lineas de control Puerto de Entrada + Salida Básico #CE #WR Registro (Latch) #OE Salida Bus de Datos Entrada Puerta de 3 estados (Transceiver) #RD #OE

More Related