View previous topic :: View next topic |
Author |
Message |
slavka012
Joined: 10 Feb 2012 Posts: 28
|
Assembler, goto instruction |
Posted: Tue Apr 28, 2015 4:56 pm |
|
|
with microchip assembler I can use the following construction:
Goto $+1
where $ denotes current PC. Is there equivalent syntax for use with inline assembler with CCS ? |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Apr 28, 2015 5:25 pm |
|
|
WHY ??
edit: duh - i forgot GOTO is a 2 cycle instruct ;-((
thiS IS Basically 2 NOP
or in ccs
delay_cycles(2);
Last edited by asmboy on Wed Apr 29, 2015 1:35 pm; edited 2 times in total |
|
|
slavka012
Joined: 10 Feb 2012 Posts: 28
|
|
Posted: Tue Apr 28, 2015 5:34 pm |
|
|
ok I already found a solution - bra 0. Hm no, compiler does not take that
.
Yes it is basically a nop, but one that takes two cycles to execute.
I can't call delay_cycles from inside the #asm block. Why I want goto $+1 instead of 2 nop's, well, no huge reason other than code being a little more compact. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19552
|
|
Posted: Tue Apr 28, 2015 11:40 pm |
|
|
Just use delay_cycles. Cheat:
Code: |
#DEFINE NOP2 #endasm delay_cycles(2); #asm
|
Then just use the instruction 'NOP2' in the assembler when you want a two cycle delay. |
|
|
|