Bonjour a tous,
Je bute sur un probleme assez simple , j'essaye de gerer une interruption provenant d'un Bp ( PUll UP a l'etat de repos ) donc sur front descendant sur la pin RC0 de mon PIC16F1455. Une lED doit changer d'etat RC3 lorsque le BP est appuyé.
Mais malheuresement lorsque j'appuie sur le BP l'interruption n'est pas geré
Voyez vous un probleme ( le programme a été recuperer sur le forum microchip qui est censé marcher) ?Code:#include <stdio.h> #include <stdlib.h> #include <xc.h> // PIC16F1455 Configuration Bit Settings // CONFIG1 #pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin) #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) #pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input) #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) #pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled) #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin) #pragma config IESO = OFF // Internal/External Switchover Mode (Internal/External Switchover Mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is disabled) // CONFIG2 #pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off) #pragma config CPUDIV = NOCLKDIV// CPU System Clock Selection Bit (NO CPU system divide) #pragma config USBLSCLK = 48MHz // USB Low SPeed Clock Selection bit (System clock expects 48 MHz, FS/LS USB CLKENs divide-by is set to 8.) #pragma config PLLMULT = 3x // PLL Multipler Selection Bit (3x Output Frequency Selected) #pragma config PLLEN = DISABLED // PLL Enable Bit (3x or 4x PLL Disabled) #pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset) #pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.) #pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled) #pragma config LVP = OFF // Low-Voltage Programming Enable (Low-voltage programming enabled) #define _XTAL_FREQ 16000000 void interrupt (){ if (INTF){ INTF=0; RC3=!RC3; } } void initINT (void){ INTCONbits.INTF=0; //Borrar bandera INTCONbits.INTE=1; //Habilitar interrupcion externa OPTION_REGbits.INTEDG=0; //interrupcion en flanco de bajada ANSELC = 0b00000000; ANSELA = 0b00000000; RC3 = 1 ; } int main (void){ OSCCON=0b01111110; //PLL disable, 3xPLL, 16Mhz, Osc Interno TRISC=0b11010111; TRISA=0b11010010; initINT(); INTCONbits.GIE=1; //Habilitar interrupciones Globales while(1){ } }
Je vous remercie
-----