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

CCP1 on 16F690 bug?

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



Joined: 27 Jan 2005
Posts: 12

View user's profile Send private message

CCP1 on 16F690 bug?
PostPosted: Fri Jan 26, 2007 3:09 pm     Reply with quote

I'm trying to figure out why my CCP is not generating interrupts. I look at the dissasembly and find this:

Code:
223:                  setup_ccp1(CCP_CAPTURE_FE);      // capture falling edge
   09D    1283     BCF 0x3, 0x5
   09E    0197     CLRF 0x17
   09F    3004     MOVLW 0x4
   0A0    0097     MOVWF 0x17
   0A1    0197     CLRF 0x17
   0A2    0196     CLRF 0x16


I would assume that the two CLRFs are supposed to clear the high and low capture registers (0x15,0x16), but instead it's clearing the CCPM control register (0x17) after it just set it up.

The header file has this:
Code:
long CCP_1;
#byte   CCP_1    =                      0x15         
#byte   CCP_1_LOW=                      0x15         
#byte   CCP_1_HIGH=                     0x16 

So it appears correct.

So is this a compiler bug?

TIA.
Mike
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 26, 2007 3:44 pm     Reply with quote

Post your compiler version.
turbo2ltr



Joined: 27 Jan 2005
Posts: 12

View user's profile Send private message

PostPosted: Fri Jan 26, 2007 3:57 pm     Reply with quote

CCS PCM C Compiler, Version 3.227
turbo2ltr



Joined: 27 Jan 2005
Posts: 12

View user's profile Send private message

PostPosted: Fri Jan 26, 2007 3:58 pm     Reply with quote

Code works great if you replace the setup_cpp1 with the asm is creates, sans the error.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 26, 2007 5:23 pm     Reply with quote

Here's the code generated for the 16F690 with PCM vs. 3.249.
Comments added.
Code:

....................  setup_ccp1(CCP_CAPTURE_FE);       
001B:  BSF    03.5    // Bank 1
001C:  BSF    07.5    // TRISC.5 = input  (CCP1 pin)
001D:  BCF    03.5    // Bank 0
001E:  CLRF   17      // CCP1CON = 0x00
001F:  MOVLW  04
0020:  MOVWF  17      // CCP1CON = 0x04
0021:  CLRF   1C      // PWM1CON = 0x00
0022:  CLRF   1D      // ECCPAS  = 0x00
0023:  BTFSS  12.2    // Is Timer2 on ?
0024:  GOTO   028     // If not, skip next code
0025:  BCF    0C.1    // Set TMR2IF flag = 0
0026:  BTFSS  0C.1    // Then wait until TMR2IF = 1
0027:  GOTO   026
0028:  BSF    03.5    // Bank 1
0029:  BSF    07.5    // TRISC.5 = input

You could write C source code to do the same thing.
Use #byte and #bit statements to define the register
addresses and write your own function called my_setup_ccp1().
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