View previous topic :: View next topic |
Author |
Message |
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
goto $+1 |
Posted: Wed Aug 06, 2003 2:57 pm |
|
|
I want to get the most compact delays that I can.
However the below code will not compile.
#ASM
goto $+1
#ENDASM
Any thoughts?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516729 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: goto $+1 |
Posted: Wed Aug 06, 2003 5:27 pm |
|
|
:=
:=I want to get the most compact delays that I can.
:=
:=However the below code will not compile.
:=
:=#ASM
:=
:= goto $+1
:=
:=#ENDASM
:=
:=Any thoughts?
-------------------------------------------------------
You could do this as a work-around:
#asm
goto label
label:
#endasm
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516735 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Thu Aug 07, 2003 6:12 am |
|
|
:=You could do this as a work-around:
:=
:=#asm
:=goto label
:=label:
:=#endasm
With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516763 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Thu Aug 07, 2003 6:15 am |
|
|
:=You could do this as a work-around:
:=
:=#asm
:=goto label
:=label:
:=#endasm
With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516768 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Thu Aug 07, 2003 6:30 am |
|
|
:=You could do this as a work-around:
:=
:=#asm
:=goto label
:=label:
:=#endasm
With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516770 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Thu Aug 07, 2003 7:10 am |
|
|
:=You could do this as a work-around:
:=
:=#asm
:=goto label
:=label:
:=#endasm
With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516773 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Thu Aug 07, 2003 7:30 am |
|
|
:=You could do this as a work-around:
:=
:=#asm
:=goto label
:=label:
:=#endasm
With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516777 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: goto $+1 |
Posted: Fri Aug 08, 2003 11:47 am |
|
|
:=With or without the #asm the above code will compile. However no code is generated for the two cycle delay (per list file).
-------------------------------------------------------------
Here is a test program that I compiled with PCM vs. 3.169.
It works OK.
<PRE>
#include "c:\Program Files\Picc\Devices\16F877.H"
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
//#use delay(clock = 8000000)
//#use rs232(baud = 9600, xmit=PIN_C6, rcv = PIN_C7, ERRORS)
<BR>
//=========================
void main()
{
<BR>
#asm
goto label
label:
#endasm
<BR>
<BR>
while(1);
}
<BR>
<BR>
Here is the .LST file:
0000 00266 .................... void main()
0000 00267 .................... {
0004 0184 00268 CLRF 04
0005 301F 00269 MOVLW 1F
0006 0583 00270 ANDWF 03,F
0007 3006 00271 MOVLW 06
0008 1683 00272 BSF 03.5
0009 009F 00273 MOVWF 1F
0000 00274 ....................
0000 00275 ....................
0000 00276 .................... #asm
0000 00277 .................... goto label
<BR>
// The compiler creates the following goto statement properly:
<BR>
000A 280B 00278 GOTO 00B
0000 00279 .................... label:
0000 00280 .................... #endasm
0000 00281 ....................
0000 00282 ....................
0000 00283 .................... while(1);
000B 280B 00284 GOTO 00B
0000 00285 .................... }
0000 00286 ....................
0000 00287 ....................
0000 00288 ....................
000C 0063 0289 SLEEP
</PRE>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516829 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Fri Aug 08, 2003 12:41 pm |
|
|
Where I am putting it to use it is not working:
do
.................... {
....................
.................... delay_us(351); // need 366us delay between transmitions
0212: MOVLW 74
0213: MOVWF 20
0214: DECFSZ 20,F
0215: GOTO 214
0216: NOP
0217: NOP
....................
.................... #ASM
....................
.................... goto lable
....................
.................... lable:
....................
.................... #endasm
....................
....................
....................
.................... i--; // (15 to 0)
0218: DECF 47,F
....................
.................... if ( bit_test(output, 23) )
.................... {
0219: BTFSS 3D.7
021A: GOTO 223
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516837 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: goto $+1 |
Posted: Fri Aug 08, 2003 1:52 pm |
|
|
:=#ASM
:=goto lable
:=
:=lable:
:=
:=#endasm
---------------------------------------------------------------
Try it with the "ASIS" keyword. That should make it work.
#ASM ASIS
goto lable
lable:
#endasm
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516842 |
|
|
Douglas Richard
Joined: 08 Sep 2003 Posts: 49 Location: Concord NH
|
Re: goto $+1 |
Posted: Mon Aug 11, 2003 6:18 am |
|
|
ASIS did the trick.
Thanks for putting in the time and effort to help me.
When all is said and done you helped me save 2 program words. It may not sound like much but every little bit counts when you are using the 12F629 and only have 2\% of the memmory remaining.
Thanks again.
doug
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516881 |
|
|
|