CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

interruption rb0 Pic 16f877a

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
leojma



Joined: 25 Feb 2013
Posts: 6

View user's profile Send private message

interruption rb0 Pic 16f877a
PostPosted: Tue May 21, 2013 6:21 pm     Reply with quote

Hi my problem is that I can do alone interrupt the every 10 sec ... if time is less not interrupted, this is a test program to learn to use the interruption but I can not interrupt .... only every 10 sec.
Code:


#if defined(__PCM__)
//#fuses HS,NOWDT,NOPROTECT,NOLVP
#include <16f877a.h>
#use delay (clock = 4 M)  //Reloj de 4 Megahertz
#include <stdlib.h> 
#use RS232 (baud=9600, bits =8, parity= N, xmit= pin_c6, rcv=pin_c7)// declaracion RS232
#use fast_io(b)
#fuses HS,NOWDT,NOPUT,NOPROTECT
int cont=0;

#int_EXT
void EXT_isr(void)
{
   putchar(120);
   putchar(121);
   
}

void main() {

   enable_interrupts(INT_EXT);
   ext_int_edge(L_TO_H); //
   enable_interrupts(GLOBAL);
   set_tris_b(0x01);
 
  while (true)
  {     
      printf("%u",cont);
      delay_ms(1000);   
      cont=cont+1;
  }
  }
 
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed May 22, 2013 1:38 pm     Reply with quote

1- don't do putc() in the ISR - it is asking for trouble.
set a flag and do the putc() in MAIN

2- unless you read port_B before leaving the interrupt - the ISR will never clear after first call

3- set_tris_B() may be causing some grief as well, in a non #FASTIO environment

4- add ,ERRORS to your #use rs232

5- this is not a CCS issue so much as it is a "read the datatsheet"
kind of problem.

There may be other problems but this ought to get you started
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group