Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Gestalt

  • Rank
  1. High everybody. I am wondering if anybody has had trouble with building a header file defining functions. Some of my programs are becoming large so I need to distribute the functions. I'm getting this general error when compiling. " error: Function 'some_function' already has a body" When it is clear I have defined the function only once! I am using this general format. ////in the header file #ifndef _HEADER_H_ #define _HEADER_H_ #include "implemenation_file.c" void some_function(var); #endif ////in the implementation file #include <system.h> #include "header.h" void some_function(var) { } Any suggestions?? Thanks
  2. Thanks for the advice, that helps out all lot! I ended up reading the manual 10 times over before it finally clicked in my head. It is working now.
  3. Wow, I actually found the source of my problems. I needed a pull down resistor on the INTE port. Works just fine now. Sorry about that. Can't believe I overlooked that!! Thanks for the input.
  4. Does anybody have any experiance writting interrupts for the 16f676. I am having problems with the interrupt routines not being able to run more than once. This happens even if the flag bit is cleared and the enable bits are set in the isr. Any suggestions?
  5. I just started writing programs with the Boost C compiler. To help me write interrupts I have been writting very simple interrupt routines on the 16f676. I wrote an interrupt routine that turns all of portC on if it is off and off if it is on when port RA2/INT goes high. The problem I am facing is that the routine excecutes only once even if I reset the GIE bit and clear the INTF flag bit in the routine. Any thoughts? Here is my code: #include <system.h> //Target PIC16f676 Configuration word #pragma DATA _CONFIG, _WDT_OFF & _PWRTE_OFF & _INTRC_OSC_NOCLKOUT & _CP_OFF void interrupt(void){ if((intcon & (1<<INTF))){ if(portc==63){ //If LED's are on turn them off portc=0;} else if(portc==0){ //If LED's are off turn them on portc=63;} clear_bit(intcon,INTF); //clear RA2/INT inrpt flag set_bit(intcon,GIE); // set global inrpts back on } } int main (void){ //Initialization of interrupts ansel=0; //Set analog ports as digital set_bit(option_reg,INTEDG); //Enable inrpt on rising edge set_bit(intcon,GIE); //Enable all unmasked inrpts set_bit(intcon,INTE); //Enable inrpt on RA2/INT port clear_bit(intcon,INTF); //Clear RA2/INT inrpt flag trisa=63; //portA is input trisc=0; // portc is output for(;{ //wait for interrupt} }
  • Create New...