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

interrupt with pic16f876

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







interrupt with pic16f876
PostPosted: Thu Mar 29, 2007 2:25 pm     Reply with quote

help,

i use compiler pcwh 4.017, pic16f876 . The interrupts ccp1 and ccp2 doesn't work . I tried the example programme EX_CCPMP from ccs, and it still not work. if i do a test " interrupt_active(int_ccp1)", it appear that the interupt is not active ( i have before write "
setup_ccp2(CCP_CAPTURE_FE)
enable_interrupts(int_ccp2)
enable_interrupts(GLOBAL)

i'm quite sure that the program is ok. is it some thing special to configure with the compiler???

thanks for any help

philippe
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2007 4:48 pm     Reply with quote

Vs. 4.017 is writing to the wrong register addresses for CCP1CON
and CCP2CON. I would ask CCS for an upgrade to a working version.
If they won't do that, then get vs. 3.249. But you need some other
version than 4.017.

Code for vs. 4.017. This has bugs.
Code:
...    setup_ccp1(CCP_CAPTURE_RE);
*
012A:  MOVLW  FF
012B:  BCF    03.5
012C:  MOVWF  2E
*
013A:  BSF    2E.2
013B:  MOVF   2E,W
013C:  BSF    03.5
013D:  MOVWF  07
013E:  CLRF   44   // Bug
013F:  MOVLW  05
0140:  MOVWF  44   // Bug

......    setup_ccp2(CCP_CAPTURE_FE);
0141:  BCF    03.5
0142:  BSF    2E.1
0143:  MOVF   2E,W
0144:  BSF    03.5
0145:  MOVWF  07
0146:  CLRF   45   // Bug
0147:  MOVLW  04
0148:  MOVWF  45   // Bug


Code for vs. 4.030:
Code:
...    setup_ccp1(CCP_CAPTURE_RE);   
*
012A:  MOVLW  FF
012B:  BCF    03.5
012C:  MOVWF  2E
*
013A:  BSF    2E.2
013B:  MOVF   2E,W
013C:  BSF    03.5
013D:  MOVWF  07
013E:  BCF    03.5
013F:  CLRF   17
0140:  MOVLW  05
0141:  MOVWF  17

....    setup_ccp2(CCP_CAPTURE_FE);
0142:  BSF    2E.1
0143:  MOVF   2E,W
0144:  BSF    03.5
0145:  MOVWF  07
0146:  BCF    03.5
0147:  CLRF   1D
0148:  MOVLW  04
0149:  MOVWF  1D



Code for 3.249:
Code:

...    setup_ccp1(CCP_CAPTURE_RE);   
*
0124:  MOVLW  FF
0125:  BCF    03.5
0126:  MOVWF  2E
*
0132:  BSF    2E.2
0133:  MOVF   2E,W
0134:  BSF    03.5
0135:  MOVWF  07
0136:  BCF    03.5
0137:  CLRF   17
0138:  MOVLW  05
0139:  MOVWF  17

...    setup_ccp2(CCP_CAPTURE_FE);
013A:  BSF    2E.1
013B:  MOVF   2E,W
013C:  BSF    03.5
013D:  MOVWF  07
013E:  BCF    03.5
013F:  CLRF   1D
0140:  MOVLW  04
0141:  MOVWF  1D
phil1
Guest







interrupts
PostPosted: Fri Mar 30, 2007 4:52 am     Reply with quote

thanks a lot
the first correction should be to write this part of code in assembler
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