![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Ivar Johnsrud Guest
|
Problem with inline assembly in PCH ver 3.114 |
Posted: Mon Oct 14, 2002 4:00 pm |
|
|
<font face="Courier New" size=-1>Hi!
I am developing a real time os to pic18 series of chips, and because I need 100\% control of several parts of the program, I am using a lot of inline assembly. I have experienced that PCH is not accepting the access bank bit which is added on many instructions in the 16 bit series of chips. Ie the movf f,d,a instruction will not compile with the a as 0 or 1. Without it, it will compile. Anyone else had problems with this? Anyone know if PCH will auto select this bit, or default it to anything? I looked at the documentation of the #asm directive, and there all the instructions were listed on f,d,a form.
<br><br>
Thanks, Ivar
<br><br>
This sample code does nothing, but illustrates the problem.
<font face ="courier new" size ="-1">
<pre>
<br>#include <18f452.h>
<br>
<br>#define FSR0H 0xFEA
<br>#define FSR0L 0xFE9
<br>#define WREG 0xFE8
<br>
<br>int offset;
<br>#locate offset=0x005 // Locate file in access ram.
<br>
<br>void main() {
<br>
<br> offset = 0x20;
<br>
<br> #asm
<br>
<br> movf FSR0H, 0
<br> subwf offset, 0, 0 // #error: Expecting an opcode mnemonic.
<br> movff WREG, FSR0H
<br>
<br> #endasm
<br>}<br><br><br><br>
</pre>
</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 7823 |
|
![](templates/subSilver/images/spacer.gif) |
R.J.Hamlett Guest
|
Re: Problem with inline assembly in PCH ver 3.114 |
Posted: Tue Oct 15, 2002 3:18 am |
|
|
:=<font face="Courier New" size=-1>Hi!
:=
:=I am developing a real time os to pic18 series of chips, and because I need 100\% control of several parts of the program, I am using a lot of inline assembly. I have experienced that PCH is not accepting the access bank bit which is added on many instructions in the 16 bit series of chips. Ie the movf f,d,a instruction will not compile with the a as 0 or 1. Without it, it will compile. Anyone else had problems with this? Anyone know if PCH will auto select this bit, or default it to anything? I looked at the documentation of the #asm directive, and there all the instructions were listed on f,d,a form.
:=<br><br>
:=Thanks, Ivar
:=<br><br>
:=This sample code does nothing, but illustrates the problem.
:=
:=<font face ="courier new" size ="-1">
:=<pre>
:=<br>#include <18f452.h>
:=<br>
:=<br>#define FSR0H 0xFEA
:=<br>#define FSR0L 0xFE9
:=<br>#define WREG 0xFE8
:=<br>
:=<br>int offset;
:=<br>#locate offset=0x005 // Locate file in access ram.
:=<br>
:=<br>void main() {
:=<br>
:=<br> offset = 0x20;
:=<br>
:=<br> #asm
:=<br>
:=<br> movf FSR0H, 0
:=<br> subwf offset, 0, 0 // #error: Expecting an opcode mnemonic.
:=<br> movff WREG, FSR0H
:=<br>
:=<br> #endasm
:=<br>}<br><br><br><br>
:=</pre>
:=
:=</font>
I had a similar problem with RETFIE, a few versions ago, which would not accept the '1' option. Asked CCS, and they updated the assembler to allow this. It is worth realising, that this will be very complex, since the compiler makes significant use of the access RAM itself. I'm afraid you'll have to ask CCS for a fix. If you only want a couple of instructions, you can add a #ROM address={value} statement latter to modify the code generated to include the extra bit.
The default is rather odd. The code given, actually generates the value 5500, which is a subwfb instruction (rather than a subwf), with the access bank disabled.
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 7828 |
|
![](templates/subSilver/images/spacer.gif) |
shep Guest
|
Re: Problem with inline assembly in PCH ver 3.114 |
Posted: Tue Oct 15, 2002 5:41 am |
|
|
:=<font face="Courier New" size=-1>Hi!
:=
:=I am developing a real time os to pic18 series of chips, and because I need 100\% control of several parts of the program, I am using a lot of inline assembly. I have experienced that PCH is not accepting the access bank bit which is added on many instructions in the 16 bit series of chips. Ie the movf f,d,a instruction will not compile with the a as 0 or 1. Without it, it will compile. Anyone else had problems with this? Anyone know if PCH will auto select this bit, or default it to anything? I looked at the documentation of the #asm directive, and there all the instructions were listed on f,d,a form.
:=<br><br>
:=Thanks, Ivar
:=<br><br>
:=This sample code does nothing, but illustrates the problem.
:=
:=<font face ="courier new" size ="-1">
:=<pre>
:=<br>#include <18f452.h>
:=<br>
:=<br>#define FSR0H 0xFEA
:=<br>#define FSR0L 0xFE9
:=<br>#define WREG 0xFE8
:=<br>
:=<br>int offset;
:=<br>#locate offset=0x005 // Locate file in access ram.
:=<br>
:=<br>void main() {
:=<br>
:=<br> offset = 0x20;
:=<br>
:=<br> #asm
:=<br>
:=<br> movf FSR0H, 0
:=<br> subwf offset, 0, 0 // #error: Expecting an opcode mnemonic.
:=<br> movff WREG, FSR0H
:=<br>
:=<br> #endasm
:=<br>}<br><br><br><br>
:=</pre>
:=
:=</font>
No idea about your problem, but i like your sig
___________________________
This message was ported from CCS's old forum
Original Post ID: 7832 |
|
![](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
|