![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Using instruction timing in Assembler |
Posted: Tue Jul 10, 2007 8:44 am |
|
|
When using in-line assembler to generate precise timing with instruction timing, it is often useful to do something like this to optionally add in one more instruction cycle:
Code: |
btfsc STATUS,C
goto $+1 ; one cycle or two, depending on STATUS,C
|
Problem 1: "$+1" is not recognized by the CCS assember (I am using an older version - perhaps the newer version does recognize it?) Of course this problem has an easy solution. Just use:
Code: |
btfsc STATUS,C
goto L123
L123:
|
Problem 2: With #OPT set any higher than 0, the goto L123 is entirely optimized away as unnecessary, which of course breaks the intention of my code. The only work-around I can find for this is to use #OPT 0, which is global and precludes the use of any optimizations elsewhere.
Any comments?
Robert Scott
Real-Time Specialties
Ypsilanti, Michigan |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Tue Jul 10, 2007 8:56 am |
|
|
Add 'asis' to the start of your assembler block.
The 'assembler' syntax, is C like in form, and hence the 'idea' of '$' for the current PC, doesn't exist.
#asm asis
btfsc STATUS,C
goto L123
L123:
#endasm
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|