Primero que nada, hola a todos. Les cuento mi problema, estoy haciendo un proyecto basado en el juego de Simon, el de las luces de colores... El tema es que lo monté, y no funcionó (No esperaba tampoco que funcione a la primera)
Escribo este tema para ver si me podrían ayudar a solucionar el problema, ya que no he podido determinar si el problema era el programa o el circuito en sí. El programa original está en C, pero con ayuda del CCS Pic, lo transformé en .HEX para luego, con el IC-Prog convertirlo en .ASM, con el que lo pasé al PIC
Estos fueron mis resultados:
Programa en .C
/******************* SIMON *********************
* *
* By Biot *
* S.I.T.T.M *
* *
***********************************************/
/******************************** ESPECIFICACIONES *****************************
El dispositivo físico consta de cuatro leds (rojo,verde,amarillo y azul)
conectados a RA0,RA1,RA2 y RA3 (en ese orden),de un altavoz conectado a RB3
y de cinco pulsadores.
Un pulsador está conectado a RB0 (para generar el color aleatorio) y los otros
cuatro,que corresponden a cada uno de los leds,están conectados a RB4,RB5,RB6
y RB7.Los pulsadores son activos a nivel alto.Los leds son activos a nivel bajo.
*******************************************************************************/
/*******************
* PREPROCESADO *
********************/
#include <16F84.h>
#use delay(clock=10000000)
#use fast_io(A)
#use fast_io(B)
#fuses HS,NOWDT,NOPUT
/****************************************
* DEFINICIÓN DE ETIQUETAS Y VARIABLES *
*****************************************/
#byte PORTA = 0x05 // Puerto A
#byte PORTB = 0x06 // Puerto B y bits utilizados
#bit RB3 = 0x06.3
#bit RB4 = 0x06.4
#bit RB5 = 0x06.5
#bit RB6 = 0x06.6
#bit RB7 = 0x06.7
#byte INTCON = 0x0B
int aleatorio,dir_lectura,dir_escritura,color_leido,leido,color_pulsado,nivel;
short fin_juego;
/***************
* SUBRUTINAS *
****************/
void retardo(int latencia)
{
switch(latencia)
{
case 1: delay_ms(200); // Correspondiente al nivel 1
break;
case 2: delay_ms(100); // Nivel 2
break;
case 3: delay_ms(50); // Nivel 3
break;
case 4: delay_ms(15); // Nivel 4
break;
default:
break;
}
}
void altavoz(int tono) // Para generar un sonido diferente para cada color
{
int i,j;
for(i=0; i<=40; i++)
{
for(j=0; j<=4; j++)
{
output_high(PIN_B3); // La distancia entre pulso y pulso viene determinada
delay_us(300*(6-tono)); // por el parámetro tono
output_low(PIN_B3);
delay_us(300*(6-tono));
}
}
}
void antirebote()
{
delay_ms(30);
while(PORTB != 0) {} // No progresamos hasta que ningún pulsador esté activo
delay_ms(30);
}
void comprueba()
{
leido = read_eeprom(dir_lectura); // Leemos la dirección eeprom correspondiente.
if(leido != color_pulsado) // Si la pulsación no ha sido correcta,acaba el
{ // juego y volvemos al principio del programa
fin_juego = true;
}
}
void enciende_led(int color) // Enciende el led correspondiente
{
switch(color)
{
case 1: output_low(PIN_A0); // Led rojo
break;
case 2: output_low(PIN_A1); // Led verde
break;
case 3: output_low(PIN_A2); // Led amarillo
break;
case 4: output_low(PIN_A3); // Led azul
break;
default: PORTA = 0; // Los 4 leds
break;
}
}
void genera_aleatorio()
{
if(aleatorio == 4) // 1 -> ROJO
{ // 2 -> VERDE
aleatorio = 1; // 3 -> AMARILLO
}else { // 4 -> AZUL
aleatorio++;
}
}
void guarda_color()
{
write_eeprom(dir_escritura,aleatorio); // Guardamos el color generado y apuntamos a
dir_escritura++; // la siguiente dirección para una próxima
} // escritura
void escoge_nivel() // El led que se mantiene encendido corresponde al nivel elegido
{
boolean sale = FALSE;
nivel = 1;
PORTA = 15;
delay_ms(100);
output_low(PIN_A0); // Por defecto,encendemos el led rojo (nivel 1).
aleatorio = 1;
while(!sale)
{
genera_aleatorio();
if(RB4)
{
nivel = 1;
PORTA = 15;
output_low(PIN_A0); // Nivel 1 - > led rojo encendido
sale = true;
antirebote();
}else if(RB5) {
nivel = 2;
PORTA = 15;
output_low(PIN_A1); // Nivel 2 - > led verde encendido
sale = true;
antirebote();
}else if(RB6) {
nivel = 3;
PORTA = 15;
output_low(PIN_A2); // Nivel 3 - > led amarillo encendido
sale = true;
antirebote();
}else if(RB7) {
nivel = 4;
PORTA = 15;
output_low(PIN_A3); // Nivel 4 - > led azul encendido
sale = true;
antirebote();
}else {
sale = false;
}
}
PORTA = 0; // Una vez hemos escogido nivel,se encienden los 4 leds
delay_ms(1000); // para indicar que podemos empezar a jugar
PORTA = 15;
delay_ms(500);
}
void has_fallado(int tono) // Si entramos aquí es que hemos pulsado incorrectamente
{
int i,j;
enciende_led(color_pulsado);
for(i=0; i<=100; i++) // Generamos tono de error (más grave)
{
for(j=0; j<=4; j++)
{
output_high(PIN_B3);
delay_ms(1*(6-tono));
output_low(PIN_B3);
delay_ms(1*(6-tono));
}
}
delay_ms(1000);
}
void muestra_colores()
{
// Desde el primero hasta el último que se ha guardado en memoria,los vamos mostrando
// con una rapidez que vendrá determinada por el nivel de dificultad elegido al principio.
for(dir_lectura = 0; dir_lectura < dir_escritura; dir_lectura++)
{
color_leido = read_eeprom(dir_lectura); // Lectura eeprom
enciende_led(color_leido); // Enciende led correspondiente
altavoz(color_leido); // Emite tono
retardo(nivel); // Retardo según nivel de dificultad
PORTA = 15; // Apaga led
retardo(nivel); // Retardo según nivel de dificultad
}
}
void pulsa_secuencia()
{
short sal;
dir_lectura = 0;
aleatorio = 1;
// Recogemos las pulsaciones y se va comprobando si son correctas hasta que
// alguna no lo sea o hasta que hayamos acertado todos los colores guardados
// hasta el momento.
// dir_escritura contiene la dirección eeprom siguiente al último color guardado
// y dir_lectura la usamos para ir consultando cada posición de memoria y comprobar
// si la pulsación ha sido correcta.En el momento en que fallemos alguna,fin_juego toma
// el valor TRUE.
// Durante la ejecución del bucle,aleatorio irá cambiando de valor,hasta que pulsemos el
// último color,momento en el cual salimos del bucle y guardamos aleatorio en memoria.
while((dir_lectura < dir_escritura) && (!fin_juego))
{
sal = false;
while(!sal) // Mientras no haya pulsación nos mantenemos dentro del bucle
{
genera_aleatorio(); // Para conseguir aleatoriedad en los colores guardados
if(input(PIN_B4)) // Se ha pulsado el rojo,salimos del bucle
{
color_pulsado = 1;
sal = true;
}else if(input(PIN_B5)) { // Se ha pulsado el verde,salimos del bucle
color_pulsado = 2;
sal = true;
}else if(input(PIN_B6)) { // Se ha pulsado el amarillo,salimos del bucle
color_pulsado = 3;
sal = true;
}else if(input(PIN_B7)) { // Se ha pulsado el azul,salimos del bucle
color_pulsado = 4;
sal = true;
}else { // No se ha pulsado ninguno,continuamos
sal = false; // dentro del bucle
}
}
comprueba(); // Algoritmo que comprueba si la pulsación ha sido correcta
enciende_led(color_pulsado); // Enciende el led del color que hemos pulsado
altavoz(color_pulsado); // Genera el tono del color que hemos pulsado
antirebote(); // No comment
PORTA = 15; // Apagamos led
dir_lectura++; // Para comprobar la siguiente dirección eeprom
}
}
/*********************
* PROGRAMA PRINCIPAL *
**********************/
void main()
{
// Inicialización periféricos
set_tris_B(0b11110000); // RB4,RB5,RB6 y RB7 entradas --- RB0,RB1,RB2 Y RB3 salidas
set_tris_A(0b00000000); // Todo salidas
output_low(PIN_B0); // RB0 no la usamos
output_low(PIN_B1); // RB1 no la usamos
output_low(PIN_B2); // RB2 no la usamos
output_low(PIN_B3); // RB3 conectado al altavoz
INTCON=0;
enable_interrupts(INT_EEPROM); // Unica interrupción habilitada durante toda la ejecución
enable_interrupts(GLOBAL); // Habilitador general de interrupciones
// Bucle principal (Se ejecuta de forma indefinida)
for(;
{
dir_escritura = dir_lectura = color_leido = leido = color_pulsado = 0; // Inicializamos variables
fin_juego = false;
aleatorio = 1;
escoge_nivel(); // Para escoger entre 4 niveles de dificultad
guarda_color(); // Guardamos en en memoria el valor que tenga aleatorio
while(!fin_juego)
{
muestra_colores(); // Mostramos colores guardados hasta el momento
pulsa_secuencia(); // Recogemos pulsaciones
guarda_color(); // Guardamos color en memoria el valor de aleatorio
if(!fin_juego) // Cada vez que acertamos una secuencia completa,encendemos
{ // los 4 leds y generamos tres tonos musicales
enciende_led(5); //
altavoz(1); //
altavoz(2); //
altavoz(4); //
PORTA = 15; //
delay_ms(1000); //
}
}
has_fallado(4); // Si hemos salido del bucle anterior es porque hemos fallado,de
} // aquí volvemos al principio del bucle principal.
}
Programa en .HEX
:1000000000308A00B62900001D30840083130008E8
:100010000319182803308D008C018C0B0D288D0BD3
:100020000C283C308C008C0B13281628800B0A28D7
:1000300000341108043C031D2028013091002128C0
:10004000910A00341E309D0004208608031D2528D7
:100050001E309D00042000341910013097000F302D
:10006000850064309D0004200510013091001918AE
:1000700064281920061E4428013097000F3085009F
:100080000510191422206328861E4E28023097007E
:100090000F3085008510191422206328061F582868
:1000A000033097000F3085000511191422206328B2
:1000B000861F6228043097000F30850085111914BF
:1000C0002220632819103728850104309A00FA305D
:1000D0009D0004209A0B67280F30850002309A009B
:1000E000FA309D0004209A0B7028CF29130889004C
:1000F000110888000B088C008B13831608155530E7
:100100008900AA308900881488188428081183126D
:100110000C088C1B8B00930A00341C08013A03194D
:100120009B28033A03199D28013A03199F28073A8F
:100130000319A128A3280510A5288510A5280511B5
:10014000A5288511A5288501A52800341030A20016
:100150008C018F019F0C9E0C031CB42820088C0777
:1001600003188F0A21088F078F0C8C0C8E0C8D0CB6
:10017000A20BAA2800340630A102031CCB28213090
:10018000840083130310800C00080319CB28C928AE
:10019000C928800BC82800349B011B08283C031C7D
:1001A00014299C011C08043C031C122986151A08FA
:1001B000063C9D0001309F002C309E00A1011D08CF
:1001C000A000A6200E089F000D089E000E08A000AB
:1001D000A00AA0030319F028FF30A100BB20E928E2
:1001E0001E08A100BB2086111A08063C9D000130A4
:1001F0009F002C309E00A1011D08A000A6200E0823
:100200009F000D089E000E08A000A00AA00303197D
:100210000D29FF30A100BB2006291E08A100BB202C
:100220009C0AD2289B0ACD2800341908013A0319E8
:100230002329033A03192729013A03192B29073ADD
:1002400003192F293329C8309D0004203429643034
:100250009D000420342932309D00042034290F30C1
:100260009D0004203429342900349201130812021D
:1002700003185129120889008316081483120808EC
:10028000940014089C008D2014089A00CC201708B4
:10029000990015210F308500170899001521920A41
:1002A0003629D32992010130910013081202031854
:1002B0009029181890291910191879291920061E43
:1002C00065290130960019147829861E6B290230A1
:1002D000960019147829061F712903309600191405
:1002E0007829861F77290430960019147829191067
:1002F0005C291208890083160814831208089500E7
:100300001608150203198529181416089C008D205B
:1003100016089A00CC2022200F308500920A552919
:10032000D42916089C008D209A011A08643C031CED
:10033000AE299B011B08043C031CAC298615190837
:10034000063C9C009D00042086111908063C9C0078
:100350009D0004209B0A9A299A0A952904309C0042
:10036000FA309D0004209C0BB029F02984018313EE
:100370001F308305F03066000030650006108610DF
:10038000061186118B010B178B1796011608950025
:100390009400920093001810013091002C287620D0
:1003A0001818ED293529522976201818EC2905301E
:1003B0009C008D2001309A00CC2002309A00CC2085
:1003C00004309A00CC200F30850004309900FA30B8
:1003D0009D000420990BE729D02904309900912928
:0403E000C5296300C8
:02400E00FA3F77
:00000001FF
;PIC16F84
Programa en .ASM
; Generated by WinDis84, (c) Nigel Goodwin 1998.
LIST P=16F84, F=INHX8M
#include "P16F84.inc"
ORG 0x0000
MOVLW 0x00
MOVWF PCLATH
GOTO Label_0001
NOP
Label_000A MOVLW 0x1D
MOVWF FSR
BCF STATUS , IRP
MOVF INDF , W
BTFSC STATUS , Z
GOTO Label_0002
Label_0007 MOVLW 0x03
MOVWF 0x0D
Label_0004 CLRF 0x0C
Label_0003 DECFSZ 0x0C , f
GOTO Label_0003
DECFSZ 0x0D , f
GOTO Label_0004
MOVLW 0x3C
MOVWF 0x0C
Label_0005 DECFSZ 0x0C , f
GOTO Label_0005
GOTO Label_0006
Label_0006 DECFSZ INDF , f
GOTO Label_0007
Label_0002 RETLW 0x00
Label_000D MOVF 0x11 , W
SUBLW 0x04
BTFSS STATUS , Z
GOTO Label_0008
MOVLW 0x01
MOVWF 0x11
GOTO Label_0009
Label_0008 INCF 0x11 , f
Label_0009 RETLW 0x00
Label_000F MOVLW 0x1E
MOVWF 0x1D
CALL Label_000A
Label_000B MOVF PORTB , f
BTFSS STATUS , Z
GOTO Label_000B
MOVLW 0x1E
MOVWF 0x1D
CALL Label_000A
RETLW 0x00
Label_004B BCF 0x19 , 00
MOVLW 0x01
MOVWF 0x17
MOVLW 0x0F
MOVWF PORTA
MOVLW 0x64
MOVWF 0x1D
CALL Label_000A
BCF PORTA , 00
MOVLW 0x01
MOVWF 0x11
Label_0014 BTFSC 0x19 , 00
GOTO Label_000C
CALL Label_000D
BTFSS PORTB , 04
GOTO Label_000E
MOVLW 0x01
MOVWF 0x17
MOVLW 0x0F
MOVWF PORTA
BCF PORTA , 00
BSF 0x19 , 00
CALL Label_000F
GOTO Label_0010
Label_000E BTFSS PORTB , 05
GOTO Label_0011
MOVLW 0x02
MOVWF 0x17
MOVLW 0x0F
MOVWF PORTA
BCF PORTA , 01
BSF 0x19 , 00
CALL Label_000F
GOTO Label_0010
Label_0011 BTFSS PORTB , 06
GOTO Label_0012
MOVLW 0x03
MOVWF 0x17
MOVLW 0x0F
MOVWF PORTA
BCF PORTA , 02
BSF 0x19 , 00
CALL Label_000F
GOTO Label_0010
Label_0012 BTFSS PORTB , 07
GOTO Label_0013
MOVLW 0x04
MOVWF 0x17
MOVLW 0x0F
MOVWF PORTA
BCF PORTA , 03
BSF 0x19 , 00
CALL Label_000F
GOTO Label_0010
Label_0013 BCF 0x19 , 00
Label_0010 GOTO Label_0014
Label_000C CLRF PORTA
MOVLW 0x04
MOVWF 0x1A
Label_0015 MOVLW 0xFA
MOVWF 0x1D
CALL Label_000A
DECFSZ 0x1A , f
GOTO Label_0015
MOVLW 0x0F
MOVWF PORTA
MOVLW 0x02
MOVWF 0x1A
Label_0016 MOVLW 0xFA
MOVWF 0x1D
CALL Label_000A
DECFSZ 0x1A , f
GOTO Label_0016
GOTO Label_0017
Label_004C MOVF 0x13 , W
MOVWF EEADR
MOVF 0x11 , W
MOVWF EEDATA
MOVF INTCON , W
MOVWF 0x0C
BCF INTCON , GIE
BSF STATUS , RP0
BSF EECON1 , 02
MOVLW 0x55
MOVWF EECON2
MOVLW 0xAA
MOVWF EECON2
BSF EECON1 , 01
Label_0018 BTFSC EECON1 , 01
GOTO Label_0018
BCF EECON1 , 02
BCF STATUS , RP0
MOVF 0x0C , W
BTFSC 0x0C , 07
MOVWF INTCON
INCF 0x13 , f
RETLW 0x00
Label_0035 MOVF 0x1C , W
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_0019
XORLW 0x03
BTFSC STATUS , Z
GOTO Label_001A
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_001B
XORLW 0x07
BTFSC STATUS , Z
GOTO Label_001C
GOTO Label_001D
Label_0019 BCF PORTA , 00
GOTO Label_001E
Label_001A BCF PORTA , 01
GOTO Label_001E
Label_001B BCF PORTA , 02
GOTO Label_001E
Label_001C BCF PORTA , 03
GOTO Label_001E
Label_001D CLRF PORTA
GOTO Label_001E
Label_001E RETLW 0x00
Label_0026 MOVLW 0x10
MOVWF 0x22
CLRF 0x0C
CLRF 0x0F
Label_0020 RRF 0x1F , f
RRF 0x1E , f
BTFSS STATUS , C
GOTO Label_001F
MOVF 0x20 , W
ADDWF 0x0C , f
BTFSC STATUS , C
INCF 0x0F , f
MOVF 0x21 , W
ADDWF 0x0F , f
Label_001F RRF 0x0F , f
RRF 0x0C , f
RRF 0x0E , f
RRF 0x0D , f
DECFSZ 0x22 , f
GOTO Label_0020
RETLW 0x00
Label_0028 MOVLW 0x06
SUBWF 0x21 , f
BTFSS STATUS , C
GOTO Label_0021
MOVLW 0x21
MOVWF FSR
BCF STATUS , IRP
BCF STATUS , C
RRF INDF , f
MOVF INDF , W
BTFSC STATUS , Z
GOTO Label_0021
GOTO Label_0022
Label_0023 GOTO Label_0022
Label_0022 DECFSZ INDF , f
GOTO Label_0023
Label_0021 RETLW 0x00
Label_0036 CLRF 0x1B
Label_002D MOVF 0x1B , W
SUBLW 0x28
BTFSS STATUS , C
GOTO Label_0024
CLRF 0x1C
Label_002C MOVF 0x1C , W
SUBLW 0x04
BTFSS STATUS , C
GOTO Label_0025
BSF PORTB , 03
MOVF 0x1A , W
SUBLW 0x06
MOVWF 0x1D
MOVLW 0x01
MOVWF 0x1F
MOVLW 0x2C
MOVWF 0x1E
CLRF 0x21
MOVF 0x1D , W
MOVWF 0x20
CALL Label_0026
MOVF 0x0E , W
MOVWF 0x1F
MOVF 0x0D , W
MOVWF 0x1E
MOVF 0x0E , W
MOVWF 0x20
INCF 0x20 , f
Label_0029 DECF 0x20 , f
BTFSC STATUS , Z
GOTO Label_0027
MOVLW 0xFF
MOVWF 0x21
CALL Label_0028
GOTO Label_0029
Label_0027 MOVF 0x1E , W
MOVWF 0x21
CALL Label_0028
BCF PORTB , 03
MOVF 0x1A , W
SUBLW 0x06
MOVWF 0x1D
MOVLW 0x01
MOVWF 0x1F
MOVLW 0x2C
MOVWF 0x1E
CLRF 0x21
MOVF 0x1D , W
MOVWF 0x20
CALL Label_0026
MOVF 0x0E , W
MOVWF 0x1F
MOVF 0x0D , W
MOVWF 0x1E
MOVF 0x0E , W
MOVWF 0x20
INCF 0x20 , f
Label_002B DECF 0x20 , f
BTFSC STATUS , Z
GOTO Label_002A
MOVLW 0xFF
MOVWF 0x21
CALL Label_0028
GOTO Label_002B
Label_002A MOVF 0x1E , W
MOVWF 0x21
CALL Label_0028
INCF 0x1C , f
GOTO Label_002C
Label_0025 INCF 0x1B , f
GOTO Label_002D
Label_0024 RETLW 0x00
Label_0037 MOVF 0x19 , W
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_002E
XORLW 0x03
BTFSC STATUS , Z
GOTO Label_002F
XORLW 0x01
BTFSC STATUS , Z
GOTO Label_0030
XORLW 0x07
BTFSC STATUS , Z
GOTO Label_0031
GOTO Label_0032
Label_002E MOVLW 0xC8
MOVWF 0x1D
CALL Label_000A
GOTO Label_0033
Label_002F MOVLW 0x64
MOVWF 0x1D
CALL Label_000A
GOTO Label_0033
Label_0030 MOVLW 0x32
MOVWF 0x1D
CALL Label_000A
GOTO Label_0033
Label_0031 MOVLW 0x0F
MOVWF 0x1D
CALL Label_000A
GOTO Label_0033
Label_0032 GOTO Label_0033
Label_0033 RETLW 0x00
Label_004E CLRF 0x12
Label_0038 MOVF 0x13 , W
SUBWF 0x12 , W
BTFSC STATUS , C
GOTO Label_0034
MOVF 0x12 , W
MOVWF EEADR
BSF STATUS , RP0
BSF EECON1 , 00
BCF STATUS , RP0
MOVF EEDATA , W
MOVWF 0x14
MOVF 0x14 , W
MOVWF 0x1C
CALL Label_0035
MOVF 0x14 , W
MOVWF 0x1A
CALL Label_0036
MOVF 0x17 , W
MOVWF 0x19
CALL Label_0037
MOVLW 0x0F
MOVWF PORTA
MOVF 0x17 , W
MOVWF 0x19
CALL Label_0037
INCF 0x12 , f
GOTO Label_0038
Label_0034 GOTO Label_0039
Label_004F CLRF 0x12
MOVLW 0x01
MOVWF 0x11
Label_0043 MOVF 0x13 , W
SUBWF 0x12 , W
BTFSC STATUS , C
GOTO Label_003A
BTFSC 0x18 , 00
GOTO Label_003A
BCF 0x19 , 00
Label_0041 BTFSC 0x19 , 00
GOTO Label_003B
CALL Label_000D
BTFSS PORTB , 04
GOTO Label_003C
MOVLW 0x01
MOVWF 0x16
BSF 0x19 , 00
GOTO Label_003D
Label_003C BTFSS PORTB , 05
GOTO Label_003E
MOVLW 0x02
MOVWF 0x16
BSF 0x19 , 00
GOTO Label_003D
Label_003E BTFSS PORTB , 06
GOTO Label_003F
MOVLW 0x03
MOVWF 0x16
BSF 0x19 , 00
GOTO Label_003D
Label_003F BTFSS PORTB , 07
GOTO Label_0040
MOVLW 0x04
MOVWF 0x16
BSF 0x19 , 00
GOTO Label_003D
Label_0040 BCF 0x19 , 00
Label_003D GOTO Label_0041
Label_003B MOVF 0x12 , W
MOVWF EEADR
BSF STATUS , RP0
BSF EECON1 , 00
BCF STATUS , RP0
MOVF EEDATA , W
MOVWF 0x15
MOVF 0x16 , W
SUBWF 0x15 , W
BTFSC STATUS , Z
GOTO Label_0042
BSF 0x18 , 00
Label_0042 MOVF 0x16 , W
MOVWF 0x1C
CALL Label_0035
MOVF 0x16 , W
MOVWF 0x1A
CALL Label_0036
CALL Label_000F
MOVLW 0x0F
MOVWF PORTA
INCF 0x12 , f
GOTO Label_0043
Label_003A GOTO Label_0044
Label_0053 MOVF 0x16 , W
MOVWF 0x1C
CALL Label_0035
CLRF 0x1A
Label_0048 MOVF 0x1A , W
SUBLW 0x64
BTFSS STATUS , C
GOTO Label_0045
CLRF 0x1B
Label_0047 MOVF 0x1B , W
SUBLW 0x04
BTFSS STATUS , C
GOTO Label_0046
BSF PORTB , 03
MOVF 0x19 , W
SUBLW 0x06
MOVWF 0x1C
MOVWF 0x1D
CALL Label_000A
BCF PORTB , 03
MOVF 0x19 , W
SUBLW 0x06
MOVWF 0x1C
MOVWF 0x1D
CALL Label_000A
INCF 0x1B , f
GOTO Label_0047
Label_0046 INCF 0x1A , f
GOTO Label_0048
Label_0045 MOVLW 0x04
MOVWF 0x1C
Label_0049 MOVLW 0xFA
MOVWF 0x1D
CALL Label_000A
DECFSZ 0x1C , f
GOTO Label_0049
GOTO Label_004A
Label_0001 CLRF FSR
BCF STATUS , IRP
MOVLW 0x1F
ANDWF STATUS , f
MOVLW 0xF0
TRIS PORTB
MOVLW 0x00
TRIS PORTA
BCF PORTB , 00
BCF PORTB , 01
BCF PORTB , 02
BCF PORTB , 03
CLRF INTCON
BSF INTCON , 0x06
BSF INTCON , GIE
Label_0054 CLRF 0x16
MOVF 0x16 , W
MOVWF 0x15
MOVWF 0x14
MOVWF 0x12
MOVWF 0x13
BCF 0x18 , 00
MOVLW 0x01
MOVWF 0x11
GOTO Label_004B
Label_0017 CALL Label_004C
Label_0052 BTFSC 0x18 , 00
GOTO Label_004D
GOTO Label_004E
Label_0039 GOTO Label_004F
Label_0044 CALL Label_004C
BTFSC 0x18 , 00
GOTO Label_0050
MOVLW 0x05
MOVWF 0x1C
CALL Label_0035
MOVLW 0x01
MOVWF 0x1A
CALL Label_0036
MOVLW 0x02
MOVWF 0x1A
CALL Label_0036
MOVLW 0x04
MOVWF 0x1A
CALL Label_0036
MOVLW 0x0F
MOVWF PORTA
MOVLW 0x04
MOVWF 0x19
Label_0051 MOVLW 0xFA
MOVWF 0x1D
CALL Label_000A
DECFSZ 0x19 , f
GOTO Label_0051
Label_0050 GOTO Label_0052
Label_004D MOVLW 0x04
MOVWF 0x19
GOTO Label_0053
Label_004A GOTO Label_0054
SLEEP
ORG 0x2000
DATA 0x0F
DATA 0x0F
DATA 0x0F
DATA 0x0F
ORG 0x2007
DATA 0x1A
ORG 0x2100
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF
END
Si alguien me podría decir si el programa es el problema, se lo agradecería mucho. Espero puedan ayudarme, desde ya muchas gracias!