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

18F452 int fast bug

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







18F452 int fast bug
PostPosted: Wed Jul 14, 2004 7:02 am     Reply with quote

Just to confirm my findings, if I use this PIC I can not use any fast int or just EXT?

I need to write a tachometer application, two possibilities are the use of ccp1 or rb0 int.. with RB0 int fast the program crashes/resets.

If I switch to CCP1 will the bug happen?
Ttelmah
Guest







Re: 18F452 int fast bug
PostPosted: Wed Jul 14, 2004 7:06 am     Reply with quote

Futureatwork wrote:
Just to confirm my findings, if I use this PIC I can not use any fast int or just EXT?

I need to write a tachometer application, two possibilities are the use of ccp1 or rb0 int.. with RB0 int fast the program crashes/resets.

If I switch to CCP1 will the bug happen?

If you are using the fast interrupt, it is _your_ responsibility to save and restore the registers in the interrupt handler routine. If the code is immediately crashing, this is probably the problem, and would apply to any interrupt used with the fast option.
Seperately, there is an issue with _old_ chips (it has been fixed for over a year), which can very occasionally cause a crash. You need to check the date code of your chip to see if this applies to you.

Best Wishes
Futureatwork
Guest







PostPosted: Wed Jul 14, 2004 7:17 am     Reply with quote

It works for some time then it gets weird, timer2 interrupt change its interrupt rate(the led blinks very fast instead of 1s) or it crashes.

The code inside of the interrupt handler is just some MOVFF and reset timer1.
Futureatwork
Guest







PostPosted: Wed Jul 14, 2004 7:29 am     Reply with quote

Code:
....................  #int_ext 
.................... void ext_isr(void) { 
....................    if(bit_test(INTCON2,INTEDGE0)) {            // rising edge detected 
*
0460:  BTFSS  FF1.6
0462:  BRA    048A
....................       setup_ccp1(CCP_OFF);                  // stop comparator so 
0466:  MOVLW  B7
0468:  ANDWF  FB1,F
046A:  CLRF   FBD
046C:  CLRF   FBD
....................       output_high(PIN_C2);                  // we can set output high 
046E:  BSF    F8B.2
....................         period=get_timer0(); set_timer0(0); 
0478:  MOVF   FD6,W
047A:  MOVFF  FD7,03
047E:  MOVWF  xC1
0480:  MOVFF  03,C2
0484:  CLRF   FD7
0486:  CLRF   FD6
....................       } else { 
0488:  BRA    04A4
....................             CCP_1=advance;                          // here we set advanve timing 
048E:  MOVFF  C4,FBF
0492:  MOVFF  C3,FBE
....................             set_timer1(0);                          // clear timer to start from 0 
0496:  CLRF   FCF
0498:  CLRF   FCE
....................          setup_ccp1(CCP_COMPARE_CLR_ON_MATCH);   // here we go! 
049A:  MOVLW  B7
049C:  ANDWF  FB1,F
049E:  BSF    F8B.2
04A0:  MOVLW  09
04A2:  MOVWF  FBD
....................    } 
....................    #asm btg INTCON2,INTEDGE0 #endasm 
04A4:  BTG    FF1.6
.................... } 
....................   
04A6:  BCF    FF2.1
04A8:  GOTO   006C


With this I expect to extend for some time the pulse received in RB0.
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