hace 6 años
Buenas noches a todos los colegas, use un tutorial para programar un pic 12f629 para aprender a usar su interrupcion externa INT, el tema es que del foro copie las configuraciones GPIO, TRISIO, y la del registro OPTION para configurar por flanco ascendente o descendente pero no es exactamente el mismo programa, le hice algunos cambios, qui copio el codigo del programita que hice:
/*
* File: alarma_3.c
* Author: NOVA
*
* Created on 17 de junio de 2019, 14:16
*/
// PIC12F629 Configuration Bit Settings
// 'C' source line config statements
// CONFIG
#pragma config FOSC = INTRCIO // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-Up Timer Enable bit (PWRT disabled)
#pragma config MCLRE = OFF // GP3/MCLR pin function select (GP3/MCLR pin function is digital I/O, MCLR internally tied to VDD)
#pragma config BOREN = ON // Brown-out Detect Enable bit (BOD enabled)
#pragma config CP = OFF // Code Protection bit (Program Memory code protection is disabled)
#pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled)
#define audio GPIObits.GP1
#include <xc.h>
void interrupt interrupcion(void)
{
char i;
char j;
// GPIO=0b00000000;
for(i=0;i<255;i++)
{
for(j=0;j<255;j++)
{
j=j;
}
}
audio=1;
for(i=0;i<255;i++)
{
for(j=0;j<255;j++)
{
j=j;
}
}
audio=0;
INTCONbits.INTF=0;
return;
}
void main(void) {
TRISIO=0b00000100;
GPIO=0b00000000;
INTCONbits.GIE=1;
INTCONbits.INTE=1;
INTCONbits.INTF=0;
// INTE=1;
// GIE=1;
OPTION_REGbits.INTEDG=1;
while(1);
return;
}
El IDE que use es el MPLAB X y el compilador c8, me arroja los siguientes errores al tratar de compilar:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/NOVA/MPLABXProjects/alarma_3.X'
make -f nbproject/Makefile-default.mk dist/default/production/alarma_3.X.production.hex
make[2]: Entering directory 'C:/Users/NOVA/MPLABXProjects/alarma_3.X'
"C:\Program Files (x86)\Microchip\xc8\v2.05\bin\xc8-cc.exe" -mcpu=12F629 -c -fno-short-double -fno-short-float -O0 -fasmfile -maddrqual=ignore -xassembler-with-cpp -Wa,-a -DXPRJ_default=default -msummary=-psect,-class,+mem,-hex,-file -ginhx032 -Wl,--data-init -mno-keep-startup -mno-osccal -mno-resetbits -mno-save-resetbits -mno-download -mno-stackcall -std=c99 -gdwarf-3 -mstack=compiled:auto:auto -o build/default/production/alarma_3.p1 alarma_3.c
::: advisory: (2049) C99 compliant libraries are currently not available for baseline or mid-range devices, or for enhanced mid-range devices using a reentrant stack; using C90 libraries
alarma_3.c:24:6: error: variable has incomplete type 'void'
void interrupt interrupcion(void)
^
alarma_3.c:24:15: error: expected ';' after top level declarator
void interrupt interrupcion(void)
^
;
2 errors generated.
make[2]: *** [build/default/production/alarma_3.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
(908) exit status = 1
nbproject/Makefile-default.mk:106: recipe for target 'build/default/production/alarma_3.p1' failed
make[2]: Leaving directory 'C:/Users/NOVA/MPLABXProjects/alarma_3.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/NOVA/MPLABXProjects/alarma_3.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 13s)
Soy nuevo en esto pero aparentemente es por algun punto y coma o por declarad void a la funcion de servicio de interrupcion, intente encontrar y corregir estos errores pero nada. Desde ya muchas gracias por sus ayudas.
¿Realmente quieres cerrar esta reparación?
Sí
No
¿Realmente quieres reabrir esta reparación?
Sí
No
¿Realmente quieres borrar este post?
Sí
No