Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Mecatrónica
SISTEMAS DIGITALES
Prof.Ing. Victor Mora Romo
Elaborado por:
11225
22 de Junio de 2013
Contenido
PRACTICA 1 UN LED ............................................................................................................................. 3
PRACTICA 2 DOS LED ........................................................................................................................... 4
PRACTICA 3 SEMAFORO ...................................................................................................................... 5
PRACTICA 4 CRUCERO SEMAFORO ..................................................................................................... 7
PRACTICA 5 SECUENCIA DE LUCES 1 ................................................................................................... 9
PRACTICA 6 SECUENCIA DE LUCES 2 ................................................................................................. 10
PRACTICA 7 SECUENCIA DE LUCES 3 ................................................................................................. 11
PRACTICA 8 UN BOTON ..................................................................................................................... 13
PRACTICA 9 BOTON VARIOS LEDS ..................................................................................................... 14
PRACTICA 10 DIP SWITCH ................................................................................................................. 15
Práctica 11 Boton con Simbologia..................................................................................................... 17
Practica 12 Compuerta not ............................................................................................................... 18
Practica 13 Compuerta AND.............................................................................................................. 19
Practica 14 Nand ............................................................................................................................... 19
Practica 15 Compuerta or ................................................................................................................. 21
Practica 16 Compuerta Nor ............................................................................................................... 21
Practica 17 Compuerta Xor ............................................................................................................... 23
Practica 18 Compuerta Xnor ............................................................................................................. 24
Practica 20 Decodificador con secuencia a bits ................................................................................ 25
Practica 21 Decodificador con salida a display 7 segmentos ............................................................ 27
Practica 23 Demultiplexor a leds....................................................................................................... 29
Practica 24 uso del LCD ..................................................................................................................... 30
PRACTICA 1 UN LED
program Un_led
main:
PORTD=0
TRISD=0
PORTD.0=1
DELAY_MS(1000)
PORTD.0=0
goto main
end.
PRACTICA 2 DOS LED
program Dos
main:
PORTD=0
TRISD=0
PORTD.0=1
DELAY_MS(1000)
PORTD.0=0
PORTD.1=1
DELAY_MS(1000)
PORTD.1=0
GOTO MAIN
end.
PRACTICA 3 SEMAFORO
program SEMAFORO
main:
PORTD=0
TRISD=0
PORTD.0=1
DELAY_MS(1000)
PORTD.0=0
PORTD.1=1
DELAY_MS(2000)
PORTD.1=0
PORTD.2=1
DELAY_MS(200)
PORTD.2=0
DELAY_MS(200)
PORTD.2=1
DELAY_MS(200)
PORTD.2=0
DELAY_MS(200)
PORTD.2=1
DELAY_MS(200)
PORTD.2=0
GOTO MAIN
end.
PRACTICA 4 CRUCERO SEMAFORO
program Crucero PORTD.2=0 PORTC.0=0
PORTD.1=1 PORTC.2=1
DELAY_MS(400) DELAY_MS(400)
PORTC.5=0 DELAY_MS(1000)
PRACTICA 5 SECUENCIA DE LUCES 1
program Secuencia_de_Luces_1
main:
ADCON0.ADON=0
ADCON1=0X07
TRISC=0
TRISD=0
PORTC=%11111111
PORTD=%00000000
DELAY_MS(500)
PORTC=%00000000
PORTD=%11111111
DELAY_MS(500)
GOTO MAIN
end.
PRACTICA 6 SECUENCIA DE LUCES 2
program Secuencia_de_Luces_2
main:
ADCON0.ADON=0
ADCON1=0X07
TRISC=0
TRISD=0
PORTC=%01010101
PORTD=%10101010
DELAY_MS(500)
PORTC=%10101010
PORTD=%01010101
DELAY_MS(500)
GOTO MAIN
end.
PRACTICA 7 SECUENCIA DE LUCES 3
program Secuencia_de_Luces_3 PORTD=%00000000
DELAY_MS(100)
DELAY_MS(100)
main: next k
ADCON0.ADON=0
ADCON1=0X07
TRISD=0 PORTC=%01010101
PORTC=%01010101 DELAY_MS(100)
PORTD=%10101010 PORTC=%10101010
DELAY_MS(500) PORTD=%01010101
PORTC=%10101010 DELAY_MS(100)
PORTD=%01010101 next k
DELAY_MS(500)
PORTC=%11111111
PRACTICA 8 UN BOTON
program Boton
main:
ADCON0.ADON=0
ADCON1=0X07
TRISA=1
TRISB=0
IF PORTA.0=1 THEN
PORTB.0=1 ELSE
PORTB.0=0
DELAY_MS(70)
END IF
GOTO MAIN
end.
PRACTICA 9 BOTON VARIOS LEDS
program Boton_varios_led
main:
ADCON1=0X07
TRISA=1
TRISB=0
IF PORTA.0=1 THEN
PORTB=%11111111 ELSE
PORTB=%00000000
DELAY_MS(70)
END IF
GOTO MAIN
end.
PRACTICA 10 DIP SWITCH
program Dip switch END IF PORTB.5=0
END IF PORTB.4=0
portb=0
end if
ADCON0.ADON=0
trisa=1 end.
trisb=0
Practica 12 Compuerta not
program _not ADCON1=0X07
PORTD=0
B = not D
goto main
main: end.
ADCON0.ADON=0
Practica 13 Compuerta AND
program _and PORTD=0
PORTB=0
B=0
main: end IF
ADCON1=0X07 END.
Practica 14 Nand
program _nand PORTB=0
trisB=0
DELAY_MS(100)
main: end IF
ADCON1=0X07
PORTD=0 end.
Practica 15 Compuerta or
program _or trisB=0
trisD=1
end IF
ADCON0.ADON=0
PORTD=0 end.
PORTB=0
trisB=0
DELAY_MS(100)
main: end IF
PORTD=0 end.
Practica 17 Compuerta Xor
program _xor trisB=0
trisD=1
end IF
ADCON0.ADON=0
PORTD=0 end.
PORTB=0
Practica 18 Compuerta Xnor
program _xnor trisB=0
trisD=1
' Declarations section IF (NOT D AND NOT D1)OR (D1 AND D) THEN
end IF
ADCON0.ADON=0
PORTD=0 end.
PORTB=0
Practica 20 Decodificador con secuencia a bits
program ADCON1=0X07 DELAY_MS(500)
DECODIFICADOR_A_BITS
trisb=1 PORTC=%00001000
symbol B = portb.0
trisc=0 DELAY_MS(500)
symbol B1 = portb.1
portb=0 PORTC=%00001001
symbol B2 = portb.2
portc=0 DELAY_MS(500)
symbol B3 = portb.3
PORTC=%00001010
symbol B4 = portb.4
PORTC=%00000000 DELAY_MS(500)
symbol B5 = portb.5
DELAY_MS(500) PORTC=%00001011
symbol B6 = portb.6
PORTC=%00000001 DELAY_MS(500)
symbol B7 = portb.7
DELAY_MS(500) PORTC=%00001100
symbol C = portc.0
PORTC=%00000010 DELAY_MS(500)
symbol C1 = portc.1
DELAY_MS(500) PORTC=%00001101
symbol C2 = portc.2
PORTC=%00000011 DELAY_MS(500)
symbol C3 = portc.3
DELAY_MS(500) PORTC=%00001110
' Declarations section
PORTC=%00000100 DELAY_MS(500)
DELAY_MS(500) PORTC=%00001111
PORTC=%00000101 DELAY_MS(500)
DELAY_MS(500)
trisb=1 PORTC=%00001000
DELAY_MS(500) PORTC=%00001111
PORTC=%00000101 DELAY_MS(500)
DELAY_MS(500)
dim LCD_RS as sbit at RA1_bit ' You can define and connect the LCD
dim txt1 as char [11] ' Define char and length for every phrase
main:
PORTB = 0
PORTA = 0
txt1 = "Carlos Ivan" ' Here you can change the text
txt3 = "La Hacienda" ' of every phrase in dim txt as char [n]
txt5 = "Mecatronica"
txt7 = "Mecatronica"
txt8 = "Materia"
txt9 = "Sistemas"
txt10 = "Digitales"
txt11 = ":):):)"
txt12 = ":):):)"
Lcd_Init() ' Initialize Lcd
Wend
End.