You are on page 1of 10

$regfile = "m32def.

dat"

$crystal = 8000000

$baud = 9600

$hwstack = 40

$swstack = 16

$framesize = 32

Ddrc.0 = 1 : Ddrc.1 = 1 : Ddrc.2 = 1 : Ddrc.3 = 1

Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0

Ddrb = &B00001111

Portb = &B11111111

A Alias Portb.0 : B Alias Portb.1 : C Alias Portb.2 : D Alias Portb.3

E Alias Pinb.4 : F Alias Pinb.5 : G Alias Pinb.6 : H Alias Pinb.7

Dim Tecla As Byte

Dim Tecla1 As Byte

Dim T As Byte

Dim Claveantigua As Word , Clavenueva As Word , V As Word , X As Word , Y As Word , Z As Word

Dim Cont As Byte

Dim W As Bit

W=0
'################################################################################
##########################################

Print "SEGURIDAD DE UN SISTEMA PARA LEDS "

Waitms 500 'TIEMPO SUSPENSION PARA QUE INICIE EL PROCESO EN


MS .

'Claveantigua = 0

'Writeeeprom Claveantigua , 0

Principal:

Goto Generarclave 'BUCLE PRINCIPAL DEL SISTEMA, Ir a la etiqueta o


dirección especificada

Goto Principal

Teclado:

Tecla = 16

A=0

If E = 0 Then Tecla = 7

If F = 0 Then Tecla = 8

If G = 0 Then Tecla = 9

If H = 0 Then Tecla = 10
A=1

B=0

If E = 0 Then Tecla = 4

If F = 0 Then Tecla = 5

If G = 0 Then Tecla = 6

If H = 0 Then Tecla = 11

B=1

C=0

If E = 0 Then Tecla = 1

If F = 0 Then Tecla = 2

If G = 0 Then Tecla = 3

If H = 0 Then Tecla = 12

C=1

D=0

If E = 0 Then Tecla = 13

If F = 0 Then Tecla = 0

If G = 0 Then Tecla = 14

If H = 0 Then Tecla = 15

D=1

If Tecla < 16 Then

Waitms 270

If Cont = 0 Then

V = Tecla

Cont = 1 'DE LO CONTRARIO PROBRAMOS OTRA CONDICIÓN

Elseif Cont = 1 Then


X = Tecla

Cont = 2

Elseif Cont = 2 Then

Y = Tecla

Cont = 3

Elseif Cont = 3 Then

Z = Tecla

Cont = 0

Waitms 250

V = V * 1000 'SEPARAR DIGITOS

X = X * 100

Y = Y * 10

Z=Z*1

Clavenueva = V + X

Clavenueva = Clavenueva + Y

Clavenueva = Clavenueva + Z

Print "la clave ingresada : " ; Clavenueva

Waitms 250

Readeeprom Claveantigua , 0

If Clavenueva = Claveantigua Then

Print "*****~~~~~~~clave correcta~~~~~~~~****"

Waitms 200

Print "PREPARANDO CONTROLES DEL SISTEMA"

For Cont = 0 To 5

Print "##################################################"

Print
"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&"
Print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

Next

Print "........... CONTROLES DEL SISTEMA............"

Waitms 200

Print "LOS CONTROLES SON CONMUTADOS"

Print " EL PUERTO C"

Goto Controlesdelsistema

Else

Print "****~~~~~~clave incorrecta~~~~~~****"

Print " reingresar clave por el teclado virtual"

Goto Teclado

End If

End If

End If

' tecla = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

' tecla = 0 1 2 3 4 5 6 7 8 9 / x - reset = +

Goto Teclado

'################################################################################
#########################3

Generarclave:

Print "Ingresar a los controles: ENTER"

Print "Cambiar clave : DELET"


Print "SALIR : ESPACIO"

T = Waitkey() 'Espera una llave

If T = 8 Then ' PROCESO PARA CAMBIAR CLAVE

Print " "

Print "CAMBIAR CLAVE DE SEGURIDAD"

Readeeprom Claveantigua , 0

Waitms 150

If Claveantigua < 1000 Then

Zzz:

Waitms 1000

Print " "

Print "INGRESE SU NUEVA CLAVE DE 4 DIGITOS"

Zz:

V = Waitkey() - 48

X = Waitkey() - 48

Y = Waitkey() - 48

Z = Waitkey() - 48

V = V * 1000

X = X * 100

Y = Y * 10

Z=Z*1

Claveantigua = V + X

Claveantigua = Claveantigua + Y

Claveantigua = Claveantigua + Z

If Claveantigua > 999 And Claveantigua < 10000 Then

Waitms 250

Writeeeprom Claveantigua , 0
Print "clave correcta"

Print " NUEVA CLAVE : " ; Claveantigua

Else

Print "valores incorectos"

Print "vuelva a ingresar clave"

Waitms 250

Goto Zz

End If

Else

Zzzz:

Print " "

Readeeprom Claveantigua , 0

Print "INGRESE CLAVE ANTERIOR"

V = Waitkey() - 48

X = Waitkey() - 48

Y = Waitkey() - 48

Z = Waitkey() - 48

Print "procesando clave"

V = V * 1000

X = X * 100

Y = Y * 10

Z=Z*1

Clavenueva = V + X

Clavenueva = Clavenueva + Y

Clavenueva = Clavenueva + Z

Waitms 250

Print "clave ingresada: " ; Clavenueva


If Clavenueva = Claveantigua Then

Print "clave correcta"

Goto Zzz

Else

Print "clave incorrecta"

Goto Zzzz:

End If

End If

End If

If T = 13 Then ' proceso de ingresar a los controles

Print " "

Print "INGRESAR CLAVE EN TECLADO VIRTUAL"

Waitms 1000

Cont = 0

Goto Teclado

End If

If T = 32 Then ' salir del sistema

Goto Salirdelsistema

End If

Goto Principal

'################################################################################
###########################################

Controlesdelsistema:

Tecla = 16
A=0

If E = 0 Then Tecla = 7

If F = 0 Then Tecla = 8

If G = 0 Then Tecla = 9

If H = 0 Then Tecla = 10

A=1

B=0

If E = 0 Then Tecla = 4

If F = 0 Then Tecla = 5

If G = 0 Then Tecla = 6

If H = 0 Then Tecla = 11

B=1

C=0

If E = 0 Then Tecla = 1

If F = 0 Then Tecla = 2

If G = 0 Then Tecla = 3

If H = 0 Then Tecla = 12

C=1

D=0

If E = 0 Then Tecla = 13

If F = 0 Then Tecla = 0

If G = 0 Then Tecla = 14

If H = 0 Then Tecla = 15

D=1

If Tecla < 8 Then

Waitms 200
Print " "

If W = 0 Then

Portc.tecla = 1

W=1

Print "puertC." ; Tecla ; " = on"

Else

Portc.tecla = 0

Print "puertC." ; Tecla ; " = off"

W=0

End If

Print " Salir precione C/on"

End If

If Tecla = 13 Then

Goto Salirdelsistema

End If

Goto Controlesdelsistema

'################################################################################
################

Salirdelsistema:

Print " "

Waitms 1000

Portc.0 = 0 : Portc.1 = 0 : Portc.2 = 0 : Portc.3 = 0

Print "MUCHAS GRACIAS %%%% (*_¬)%%%%"

Print "Para reingresar solo resetee el micro"

End

You might also like