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 handler

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



Joined: 01 Jul 2007
Posts: 37

View user's profile Send private message

Interrupt handler
PostPosted: Wed Oct 03, 2007 1:52 pm     Reply with quote

Hi,

16f876A
pcwh 4.053


Is there a way to reduce the size of the interrupt handler generated by CCS ?
Here is a very simple program that shows the size of the generated code for a simple assignment :

Code:
#include <16F876A.h>
#FUSES NOWDT                    //No Watch Dog Timer
#FUSES HS                       //High speed Osc (> 4mhz)
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES DEBUG                    //Debug mode for use with ICD
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#use delay(clock=20000000)

int i;

#int_TIMER0
void TIMER0_isr(void)
{
   i++;
}

void main()
{
}


=================


0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   038
0003:  NOP

----- default IT handler begin !!
0004:  MOVWF  7F
0005:  SWAPF  03,W
0006:  CLRF   03
0007:  MOVWF  21
0008:  MOVF   0A,W
0009:  MOVWF  20
000A:  CLRF   0A
000B:  MOVF   04,W
000C:  MOVWF  22
000D:  MOVF   77,W
000E:  MOVWF  23
000F:  MOVF   78,W
0010:  MOVWF  24
0011:  MOVF   79,W
0012:  MOVWF  25
0013:  MOVF   7A,W
0014:  MOVWF  26
0015:  MOVF   7B,W
0016:  MOVWF  27
0017:  BCF    03.7
0018:  BCF    03.5
0019:  BTFSS  0B.5
001A:  GOTO   01D
001B:  BTFSC  0B.2
001C:  GOTO   030
001D:  MOVF   22,W
001E:  MOVWF  04
001F:  MOVF   23,W
0020:  MOVWF  77
0021:  MOVF   24,W
0022:  MOVWF  78
0023:  MOVF   25,W
0024:  MOVWF  79
0025:  MOVF   26,W
0026:  MOVWF  7A
0027:  MOVF   27,W
0028:  MOVWF  7B
0029:  MOVF   20,W
002A:  MOVWF  0A
002B:  SWAPF  21,W
002C:  MOVWF  03
002D:  SWAPF  7F,F
002E:  SWAPF  7F,W
002F:  RETFIE
--- default it handler end !!


0030:  BCF    0A.3
0031:  BCF    0A.4
0032:  GOTO   033



.................... int i;
.................... 
.................... #int_TIMER0
.................... void TIMER0_isr(void) 
.................... {
....................    i++;
0033:  INCF   28,F
.................... }
.................... 
.................... 
0034:  BCF    0B.2
0035:  BCF    0A.3
0036:  BCF    0A.4
0037:  GOTO   01D


.................... void main()
.................... {
0038:  CLRF   04
0039:  BCF    03.7
003A:  MOVLW  1F
003B:  ANDWF  03,F
003C:  BSF    03.5
003D:  BSF    1F.0
003E:  BSF    1F.1
003F:  BSF    1F.2
0040:  BCF    1F.3
0041:  MOVLW  07
0042:  MOVWF  1C
.................... }
0043:  SLEEP

Configuration Fuses:
   Word  1: 3772   HS NOWDT PUT DEBUG NOPROTECT BROWNOUT NOLVP NOCPD NOWRT



Thanks
Dimmu
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 03, 2007 2:14 pm     Reply with quote

Look at the CCS example file for #int_global. It's in this directory:
Quote:
c:\program files\picc\examples\ex_glint.c

See this thread which explains the CCS interrupt dispatcher:
http://www.ccsinfo.com/forum/viewtopic.php?t=29173
Dimmu



Joined: 01 Jul 2007
Posts: 37

View user's profile Send private message

PostPosted: Thu Oct 04, 2007 1:03 am     Reply with quote

Thank you for the perfect answer, as usual !!

Dimmu
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