View previous topic :: View next topic |
Author |
Message |
Eugeneo
Joined: 30 Aug 2005 Posts: 155 Location: Calgary, AB
|
Compiler adding unwanted extra code |
Posted: Sun Mar 05, 2006 11:09 am |
|
|
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
|
|
 |
Eugeneo
Joined: 30 Aug 2005 Posts: 155 Location: Calgary, AB
|
|
Posted: Sun Mar 05, 2006 11:23 am |
|
|
This seems to work
#define Write_to_spi(value) {#ASM \
MOVF value,W \
MOVWF 0x13 \
#ENDASM} |
|
 |
|