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

Assembler, goto instruction

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



Joined: 10 Feb 2012
Posts: 28

View user's profile Send private message

Assembler, goto instruction
PostPosted: Tue Apr 28, 2015 4:56 pm     Reply with quote

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

View user's profile Send private message AIM Address

PostPosted: Tue Apr 28, 2015 5:25 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Apr 28, 2015 5:34 pm     Reply with quote

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: 19539

View user's profile Send private message

PostPosted: Tue Apr 28, 2015 11:40 pm     Reply with quote

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.
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