no pence que la ayuda fuera cobrada y mucho menos que en lugar de ayudar y brindar conocimientos fura hacer problema de dinero ... :shock:
AllDigital 'Todos los pines del puerto A como E/S.
TRISA = %11111111 'Puerto A como entradas
TRISB = %00001111 'Puerto B: 4 entradas, 4 salidas
'Declaro las variables a utilizar
Dim tecla As Byte 'Tecla presionada
tecla = 16 '16 = no hay tecla presionada
'Bucle principal
loop:
'Leo el teclado
Gosub leoteclado
WaitMs 10 'Espero
'Sigo con el resto del programa...
Goto loop 'vuelvo a loop: para repetir indefinidamente.
End
leoteclado:
tecla = 16 '16 = no hay tecla presionada
'Leo la primer columna
PORTB = %10000000
If PORTB.3 = 1 Then tecla = 1 'Tecla "1"
If PORTB.2 = 1 Then tecla = 4 'Tecla "4"
If PORTB.1 = 1 Then tecla = 7 'Tecla "7"
If PORTB.0 = 1 Then tecla = 10 'Tecla "*"
'Leo la segunda columna
PORTB = %01000000
If PORTB.3 = 1 Then tecla = 2 'Tecla "2"
If PORTB.2 = 1 Then tecla = 5 'Tecla "5"
If PORTB.1 = 1 Then tecla = 8 'Tecla "8"
If PORTB.0 = 1 Then tecla = 0 'Tecla "0"
'Leo la tercer columna
PORTB = %00100000
If PORTB.3 = 1 Then tecla = 3 'Tecla "3"
If PORTB.2 = 1 Then tecla = 6 'Tecla "6"
If PORTB.1 = 1 Then tecla = 9 'Tecla "9"
If PORTB.0 = 1 Then tecla = 11 'Tecla "#"
'Leo la cuarta columna
PORTB = %00010000
If PORTB.3 = 1 Then tecla = 12 'Tecla "TEST"
If PORTB.2 = 1 Then tecla = 13 'Tecla "PANICO"
If PORTB.1 = 1 Then tecla = 14 'Tecla "F1"
If PORTB.0 = 1 Then tecla = 15 'Tecla "F2"
ReturnAllDigital 'Todos los pines del puerto A como E/S.
TRISA = %11111111 'Puerto A como entradas
TRISB = %00001111 'Puerto B: 4 entradas, 4 salidas
'Declaro las variables a utilizar
Dim tecla As Byte 'Tecla presionada
tecla = 16 '16 = no hay tecla presionada
'Bucle principal
loop:
'Leo el teclado
Gosub leoteclado
WaitMs 10 'Espero
'Sigo con el resto del programa...
Goto loop 'vuelvo a loop: para repetir indefinidamente.
End
leoteclado:
tecla = 16 '16 = no hay tecla presionada
'Leo la primer columna
PORTB = %10000000
If PORTB.3 = 1 Then tecla = 1 'Tecla "1"
If PORTB.2 = 1 Then tecla = 4 'Tecla "4"
If PORTB.1 = 1 Then tecla = 7 'Tecla "7"
If PORTB.0 = 1 Then tecla = 10 'Tecla "*"
'Leo la segunda columna
PORTB = %01000000
If PORTB.3 = 1 Then tecla = 2 'Tecla "2"
If PORTB.2 = 1 Then tecla = 5 'Tecla "5"
If PORTB.1 = 1 Then tecla = 8 'Tecla "8"
If PORTB.0 = 1 Then tecla = 0 'Tecla "0"
'Leo la tercer columna
PORTB = %00100000
If PORTB.3 = 1 Then tecla = 3 'Tecla "3"
If PORTB.2 = 1 Then tecla = 6 'Tecla "6"
If PORTB.1 = 1 Then tecla = 9 'Tecla "9"
If PORTB.0 = 1 Then tecla = 11 'Tecla "#"
'Leo la cuarta columna
PORTB = %00010000
If PORTB.3 = 1 Then tecla = 12 'Tecla "A"
If PORTB.2 = 1 Then tecla = 13 'Tecla "B"
If PORTB.1 = 1 Then tecla = 14 'Tecla "C"
If PORTB.0 = 1 Then tecla = 15 'Tecla "D"
ReturnMe ha llamado la atención tu esquemático aj267, muy estético! :P
Puedo preguntarte, qué editor de circuitos utilizas?
Saludos, nos leemos! :mrgreen:
Me ha llamado la atención tu esquemático aj267, muy estético! :PYo estaba por preguntar lo mismo, es atractivo el esquematico, me suena a estar dibujado con algun soft para graficos vectoriales.
Puedo preguntarte, qué editor de circuitos utilizas?
Saludos, nos leemos! :mrgreen:
Se que está pasando las de cain.Te cuento que a mí me pasó lo mismo... yo también me mataba solito :D
El tipo me recuerda cuando yo comencé, yo no preguntaba me mataba solo,
pero el es más arriesgado el se lanza de una.Pues yo ando igual que tú IAO... como tú dices... "pelando" :D
Seguro tiene novia y yo por timido y discreto ando pelando.... :D :D :D
:D :D :D :D
Si te consigues una novia programadora, vivirán peleando por usar el computador.
No tendrán tiempo para hacer bebes... :D :D :D :D :-)
es que fijense que tengo variables en donde almaceno una clave pero esa clave tendria que estar guardada en la memoria del PIC que no se borra, si me explico !! para que se pueda cambiar cada vez que yo asi lo decea sin necesidad de estar quemando un PIC por cada clave nueva que quiera poner !!!
EEPROM {localización} [valores]
Por ejemplo:EEPROM 0, [1,2,3] 'almacena los valores 1,2,3 comenzando en la posición 0 de la EEPROM.
Read 5,B2 'coloca el valor de la localización 5 de la memoria EEPROM en la variable B2.
Write 5,B0 'envía el valor en B0 a la EEPROM en la localización 5.
pbp -p<numero del pic> <nombre del archivo>.bas...
pbp -p16f877 prueba_aj.bas
WaitUs 100 que normalmente es el pausa se usa DELAY_MS(100) o algo asi y al usarlo me carag un monton de fuciones en ensamblador que no estoy usando y me dice 45% libre de memoria ROM y si no lo uso y lo copilo me dice 80% de memoria ROM libre ... por dar un ejemplo yme usa mas espacio del que en realidad usoDevice 16F84A
ALL_DIGITAL = True
TRISA = %00000 'Todos los pines del puerto A como Salidas
TRISB = %00001111 '4 pines del puerto B como entrada y los otros 4 como salida
Symbol LedPss = PORTA.0 'Led Azul que se enciende cada ves que se preiona una tecla
Symbol Luz = PORTA.1 'Son los 4 focos que alumbran el teclado
dim xLuz as byte 'Temporizador de la luz
Dim Tecla As Byte
dim Opend as byte
'----------------------------------------------------------------------------------------
main:
gosub setstart
ScanKeyPad:
gosub leoteclado, tecla
select tecla
case 14
case 12
case 13
case 15
case 0,1,2,3,4,5,6,7,8,9
xluz = 1
if luz = 0 then luz = 1
endselect
if xluz >= 1 and xluz <= 25 then
xluz = xluz + 1
else
xluz = 0
if luz = 1 then luz = 0
endif
goto ScanKeyPad
end
'----------------------------------------------------------------------------------------
setStart:
Tecla = 16 : LedPss = 0
Luz = 0 : xLuz = 0
return
'----------------------------------------------------------------------------------------
LeoTeclado:
tecla = 16 '16 = no hay tecla presionada
PORTB = %10000000 'Leo la primer columna
If PORTB.3 = 1 Then tecla = 1 'Tecla "1"
If PORTB.2 = 1 Then tecla = 4 'Tecla "4"
If PORTB.1 = 1 Then tecla = 7 'Tecla "7"
If PORTB.0 = 1 Then tecla = 10 'Tecla "*"
PORTB = %01000000 'Leo la segunda columna
If PORTB.3 = 1 Then tecla = 2 'Tecla "2"
If PORTB.2 = 1 Then tecla = 5 'Tecla "5"
If PORTB.1 = 1 Then tecla = 8 'Tecla "8"
If PORTB.0 = 1 Then tecla = 0 'Tecla "0"
PORTB = %00100000 'Leo la tercer columna
If PORTB.3 = 1 Then tecla = 3 'Tecla "3"
If PORTB.2 = 1 Then tecla = 6 'Tecla "6"
If PORTB.1 = 1 Then tecla = 9 'Tecla "9"
If PORTB.0 = 1 Then tecla = 11 'Tecla "#"
PORTB = %00010000 'Leo la cuarta columna
If PORTB.3 = 1 Then tecla = 12 'Tecla "Cancelar"
If PORTB.2 = 1 Then tecla = 13 'Tecla "Cerrar"
If PORTB.1 = 1 Then tecla = 14 'Tecla "Aceptar"
If PORTB.0 = 1 Then tecla = 15 'Tecla "D"
return
'----------------------------------------------------------------------------------------if (condicion) LedPss=0
else LedPss=1
Para que no se encienda cuando no debe... bueno no más es una sugerencia, yo no he trabajado en protón... pero me parece que debería ser así... :lol:si esta puesta en el inicio del programa mando a llamar la subrutina setStart y ahi esta la variable LedPss = 0 :( y eso es lo mas raro ...
Dim eclave As Word ' <- Almacenar ahi por ejemplo "2685"
main:
eclave = leermemo
end
var1 = 1
var2 = 2
var = var1 (+) var2 'Que el resultados seria "3" y yo quiero que sea "12"
Dim tecla As Byte se guarda el numero de la tecla precionadatecla = 2 luego preciono otra tecla por decir algo el 6 la variable queda asi tecla = 6 pero en ningun momento voy almacennado el orden de las teclas precionadas ... me explico luego como se que teclas preciono ???getkeypad:
teclap = 16 '16 = no hay teclap presionada
If opened = 0 Then
PORTB = %10000000 'Leo la primer columna
If PORTB.3 = 1 Then teclap = 1 'teclap "1"
If PORTB.2 = 1 Then teclap = 4 'teclap "4"
If PORTB.1 = 1 Then teclap = 7 'teclap "7"
If PORTB.0 = 1 Then teclap = 10 'teclap "*"
WaitUs 600
PORTB = %01000000 'Leo la segunda columna
If PORTB.3 = 1 Then teclap = 2 'teclap "2"
If PORTB.2 = 1 Then teclap = 5 'teclap "5"
If PORTB.1 = 1 Then teclap = 8 'teclap "8"
If PORTB.0 = 1 Then teclap = 0 'teclap "0"
WaitUs 600
PORTB = %00100000 'Leo la tercer columna
If PORTB.3 = 1 Then teclap = 3 'teclap "3"
If PORTB.2 = 1 Then teclap = 6 'teclap "6"
If PORTB.1 = 1 Then teclap = 9 'teclap "9"
If PORTB.0 = 1 Then teclap = 11 'teclap "#"
WaitUs 600
Endif
PORTB = %00010000 'Leo la cuarta columna
If PORTB.3 = 1 Then teclap = 12 'teclap "Borrar"
If PORTB.2 = 1 Then teclap = 13 'teclap "Cerrar"
If PORTB.1 = 1 Then teclap = 14 'teclap "Aceptar"
If PORTB.0 = 1 Then teclap = 15 'teclap "Cambiar Clave"
Return
main:
GoSub getkeypad 'Primero leo la tecla precionada (si se a precionada una tecla la variable TECLA seria distinta de 16)
if tecla <= 9 then
'si entra aqui es porque presiono un digito del 0 al 9
endif
GoTo main 'Genero un bucle infinito
End
Bueno en pic basic no te puedo ayudar mucho...Lo que te quería decir realmente era: "en Pic Simulator IDE no te puedo ayudar mucho"...
value1 = 1;
value2 = 2;
value_total = value1<<4 || value2
Puedes encontrar más info aquí: Librería para Display de Nokia 3310 con C30 y dsPIC
no tendras tu por ahi el esquema o me prodrias proporcionar la lista de materiales que tu usastes pues es mejor asi de todas formas a ti te funciono !!
Bueno, es una prueba que hice y sólo conservo el programa. No el esquema, aunque dentro del propio código fuente están explicadas las conexiones a realizar. Yo usé un dsPIC30F, pero puedes hacerlo también con otros micros.
Cámbiate al 16F88 que es mucho más barato, mucho más potente, ocupa el mismo espacio, y tiene conversores adc.
hola a todos soy novato en esto y es mi primer tema y me preguntaba si me podian ayudar a hacer un proyecto:
por medio de un PIC 16F84A ( por que aquí en mi país solo estos microcontroladores venden ) hacer un sistema de seguridad [...]
getKeyPad:
tecla = 16
if opened = 0 then
PORTB = %10000000 'Leo la primer columna
If PORTB.3 = 1 Then tecla = 1 endif 'Tecla "1"
if tecla != 16 then return
If PORTB.2 = 1 Then tecla = 4 endif 'Tecla "4"
if tecla != 16 then return
If PORTB.1 = 1 Then tecla = 7 endif 'Tecla "7"
if tecla != 16 then return
If PORTB.0 = 1 Then tecla = 10 endif 'Tecla "*"
if tecla != 16 then return
PORTB = %01000000 'Leo la segunda columna
If PORTB.3 = 1 Then tecla = 2 endif 'Tecla "2"
if tecla != 16 then return
If PORTB.2 = 1 Then tecla = 5 endif 'Tecla "5"
if tecla != 16 then return
If PORTB.1 = 1 Then tecla = 8 endif 'Tecla "8"
if tecla != 16 then return
If PORTB.0 = 1 Then tecla = 0 endif 'Tecla "0"
if tecla != 16 then return
PORTB = %00100000 'Leo la tercer columna
If PORTB.3 = 1 Then tecla = 3 endif 'Tecla "3"
If PORTB.2 = 1 Then tecla = 6 endif 'Tecla "6"
If PORTB.1 = 1 Then tecla = 9 endif 'Tecla "9"
If PORTB.0 = 1 Then tecla = 11 endif 'Tecla "#"
endif
PORTB = %00010000 'Leo la cuarta columna
If PORTB.3 = 1 Then tecla = 12 endif 'Tecla "Cerrar"
if tecla != 16 then return
If PORTB.2 = 1 Then tecla = 13 endif 'Tecla "Cancelar"
if tecla != 16 then return
If PORTB.1 = 1 Then tecla = 14 endif 'Tecla "Aceptar"
if tecla != 16 then return
If PORTB.0 = 1 Then tecla = 15 endif 'Tecla "Cambiar Clave"
return
(http://i299.photobucket.com/albums/mm310/JoseRMG/PIC16F877.gif)
SE PUEDEN VOLVER A QUEMAR LOS PIC UNA VEZ YA QUEMADOS Y CUANTAS VECES LO PERMITE, SI FUERA ESTO POSIBLE ????
'-----------------------------------------------------------------------------------------------------------------
doError:
cer = cer + 1
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 26
pleda = 1 : pledb = 0 : pledc = 0 : pledd = 1 : plede = 1 : pledf = 1 : pledg = 1 : pledp = 0
delayms 26 : pll01 = 1
delayms 260
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 26
pleda = 0 : pledb = 0 : pledc = 0 : pledd = 0 : plede = 1 : pledf = 0 : pledg = 1 : pledp = 0
delayms 26 : pll02 = 1
delayms 260
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 26
pleda = 0 : pledb = 0 : pledc = 0 : pledd = 0 : plede = 1 : pledf = 0 : pledg = 1 : pledp = 0
delayms 26 : pll03 = 1
delayms 260
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 26
pleda = 0 : pledb = 0 : pledc = 1 : pledd = 1 : plede = 1 : pledf = 0 : pledg = 1 : pledp = 0
delayms 26 : pll04 = 1
delayms 260
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 26
pleda = 0 : pledb = 0 : pledc = 0 : pledd = 0 : plede = 1 : pledf = 0 : pledg = 1 : pledp = 0
delayms 26 : pll05 = 1
delayms 260
if cer < 8 then gosub doerror else return endif
return
'-----------------------------------------------------------------------------------------------------------------
pll01 = 0 : pll02 = 0 : pll03 = 0 : pll04 = 0 : pll05 = 0 : delayms 262° Configuro la letra en el display, osea pongo a 1 el led del dsipley que quiero encender, en este caso la letra "E"
pleda = 1 : pledb = 0 : pledc = 0 : pledd = 1 : plede = 1 : pledf = 1 : pledg = 1 : pledp = 03° Espero otros 26 milisegundos y luego prendo el display para mostrar la letra
delayms 26 : pll01 = 14° Espero 260 milisegundos para luego mostrar la siguiente letra en el siguiente displays
delayms 260
lo hago mediante interrupciones
DEVICE 16F877
OPTION_REG = %00000111
INTCON = %00100000
SYMBOL LED = PORTD.0
ON INTERRUPT GOTO My_Int ' Enable software interrupts, and point to interrupt handler
Fin:
DELAYMS 1
GOTO Fin
DISABLE ' Disable interrupts in the handler
My_Int:
TOGGLE LED ' Toggle an LED when interrupted
RESUME ' Return to main program
ENABLE ' Enable interrupts after the handler
Fin:
DELAYMS 1
GOTO Finy luego ponerDISABLE ' Disable interrupts in the handlerhola a todos soy novato en esto y es mi primer tema y me preguntaba si me podían ayudar a hacer un proyecto:
Un sistema de clave similar al de CHEVYSTAR, esto es utilizando 3 pulsadores, un
led rojo y un relé de 12 voltios, si la clave 1223 es presionada correctamente activa el
relé, caso contrario se enciende el led rojo por 2 segundos indicando que falló la clave,
después de 3 intentos fallidos, el sistema debe bloquearse por 1 minuto, transcurrido ese
tiempo puede volver a intentar nuevamente.
esto es el proyecto que quiero desarrollar y me pregunto si es posible hacer lo no encuentro mucha información de como hacer algo así
de atemano muchas gracias