Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About 32bits

  • Rank
  1. Hi, I am new to the forum, nice to meet you everyone! I am working on a project that needs to do an interrupt from external source (RB0/INT) every time that there is a falling edge (TTL), at the moment I am just testing it with a push button, but the final idea is to use a quadrature signal as a input, similar to an encoder signal (I do not know if that can be done yet), but I want to go step by step. Below is my code, basically every time that I push the button it should go to the interrupt but it won't go when I am debugging, I do not know if I am doing something wrong, i would appreciate your help. By the way I am using boostc compiler and pic16f877a. Many thanks. #include <system.h> #ifdef _PIC16F877A #pragma DATA _CONFIG, _CP_OFF & _PWRTE_OFF & _WDT_OFF & _HS_OSC & _LVP_OFF #endif #pragma CLOCK_FREQ 16000000 void inter_set(); void main() { inter_set(); while(1); { porte.0 = 0; } } void inter_set() { trisb = 0b11111111; //PortB as input trise = 0b00000000; //PortE as output option_reg = 0b10000000; // Interrupt on falling edge of RB0/INT pin intcon = 0b00000000; // Clear interrupt intcon = 0b10010000; // Enables the RB0/INT external interrupt } void interrupt() { porte.0 = 1; clear_bit( intcon, RBIF ); // Clear flag bit } My configuration:
  • Create New...