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 support@ccsinfo.com

Compiler adding unwanted extra code

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



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

Compiler adding unwanted extra code
PostPosted: Sun Mar 05, 2006 11:09 am     Reply with quote

Shown below I'm writing a byte using the spi_write command. Since there is a timer calling this routine at certain intervals, there is no need to poll the SPI Transmit in progress bit (0x94.0 or bank1-14.0). I need to free to processor for a interrupt critical routine. Can I remove the excess code without using the #use asm directive?



Code:

....................       spi_write(RBZ);
0142:  MOVF   33,W
0143:  MOVWF  13
0144:  BSF    03.5      Don't need from here
0145:  BTFSC  14.0
0146:  GOTO   149
0147:  BCF    03.5
0148:  GOTO   144     To here
....................       CCPIF=0;
0149:  BCF    03.5
014A:  BCF    0C.2
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 11:12 am     Reply with quote

The following thread gives some useful macro alternatives to the CCS functions: http://www.ccsinfo.com/forum/viewtopic.php?t=26128
Eugeneo



Joined: 30 Aug 2005
Posts: 155
Location: Calgary, AB

View user's profile Send private message

PostPosted: Sun Mar 05, 2006 11:23 am     Reply with quote

This seems to work

#define Write_to_spi(value) {#ASM \
MOVF value,W \
MOVWF 0x13 \
#ENDASM}
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