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 support@ccsinfo.com

Problem with inline assembly in PCH ver 3.114

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







Problem with inline assembly in PCH ver 3.114
PostPosted: Mon Oct 14, 2002 4:00 pm     Reply with quote

<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
R.J.Hamlett
Guest







Re: Problem with inline assembly in PCH ver 3.114
PostPosted: Tue Oct 15, 2002 3:18 am     Reply with quote

:=<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
shep
Guest







Re: Problem with inline assembly in PCH ver 3.114
PostPosted: Tue Oct 15, 2002 5:41 am     Reply with quote

:=<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 Smile
___________________________
This message was ported from CCS's old forum
Original Post ID: 7832
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