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

#asm and pic18 access bank

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







#asm and pic18 access bank
PostPosted: Tue Dec 10, 2002 2:42 am     Reply with quote

can anyone tell me how to use the access bank when doing #asm commands with the pic18. internally ccs use

bcf xd8,0 // status register carry bit

but when you put this in the source it throws an error
___________________________
This message was ported from CCS's old forum
Original Post ID: 9926
R.J.Hamlett
Guest







Re: #asm and pic18 access bank
PostPosted: Tue Dec 10, 2002 5:21 am     Reply with quote

:=can anyone tell me how to use the access bank when doing #asm commands with the pic18. internally ccs use
:=
:=bcf xd8,0 // status register carry bit
:=
:=but when you put this in the source it throws an error
It would do.
'xd8', is a label, and you will get an undefined label error (unless you have something defined called 'xd8'). The syntax for a hexadecimal number, is '0xd8', which will work fine.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 9928
DuncanH
Guest







Re: #asm and pic18 access bank
PostPosted: Tue Dec 10, 2002 10:35 am     Reply with quote

:=:=can anyone tell me how to use the access bank when doing #asm commands with the pic18. internally ccs use
:=:=
:=:=bcf xd8,0 // status register carry bit
:=:=
:=:=but when you put this in the source it throws an error
:=It would do.
:='xd8', is a label, and you will get an undefined label error (unless you have something defined called 'xd8'). The syntax for a hexadecimal number, is '0xd8', which will work fine.

Sorry I did not explain enough the xd8 shows that it is using the access bank to do fast ram read and write the actual address of the status is 0xfd8 but when you use the access bank addressing you do not need to put the F at the begining however although there is a tempting glimpse of it in the documetation I cannot see anyway of getting it working from my source. See #asm in help file pic 18

bcf f,b,a - does a mean access or what it is not defined
___________________________
This message was ported from CCS's old forum
Original Post ID: 9938
R.J.Hamlett
Guest







Re: #asm and pic18 access bank
PostPosted: Tue Dec 10, 2002 12:28 pm     Reply with quote

:=:=:=can anyone tell me how to use the access bank when doing #asm commands with the pic18. internally ccs use
:=:=:=
:=:=:=bcf xd8,0 // status register carry bit
:=:=:=
:=:=:=but when you put this in the source it throws an error
:=:=It would do.
:=:='xd8', is a label, and you will get an undefined label error (unless you have something defined called 'xd8'). The syntax for a hexadecimal number, is '0xd8', which will work fine.
:=
:=Sorry I did not explain enough the xd8 shows that it is using the access bank to do fast ram read and write the actual address of the status is 0xfd8 but when you use the access bank addressing you do not need to put the F at the begining however although there is a tempting glimpse of it in the documetation I cannot see anyway of getting it working from my source. See #asm in help file pic 18
:=
:=bcf f,b,a - does a mean access or what it is not defined

You are missing the point of my reply. You are actually complaining about the wrong error. :-)

You cannot use the syntax 'xf8', because this will be seen as a variable, not an address. This has to be preceeded with the '0', to tell the compiler that this is an address. The code fed into the compiler has to use the 'C' syntax, rather than assembler syntax.
Now the actual syntax of the assembler required for the access bank, is defined in the Microchip data sheet, with a=0, implying access bank, and a=1, implying to use the BSR. This value goes into bit 0 of the MSByte of the resulting instruction. If you look at the hex output that is generated for the code.
The required syntax to correctly override the access bank, then would be:
#asm
bcf 0xd8,0,0
#endasm

The instruction:
#asm
bcf 0xd8,0
#endasm
Will produce exactly the same assembler as you show...

Unfortunately, the compiler does not (yet) recognise the second ',0', and instead complains on this (not on the 'xd8').
So the point is that your 'example' given, is failing, because you are trying the wrong thing (xd8), not because of the access bank...

I had the same problem some time ago, with the internal compiler not handling the 'RETFIE 1' syntax, again despite the help file showing the full syntax. I complained about this to CCS (and in the meantime just coded round it by using the #rom directive to put the correct byte in the location). CCS fixed this very quickly, and do now accept this syntax.

Try actually inputing what I showed. This doesn't give the access bank override, but is compatible with what CCS are generating at present.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 9947
DuncanH
Guest







Re: #asm and pic18 access bank
PostPosted: Tue Dec 10, 2002 1:55 pm     Reply with quote

:=:=:=:=can anyone tell me how to use the access bank when doing #asm commands with the pic18. internally ccs use
:=:=:=:=
:=:=:=:=bcf xd8,0 // status register carry bit
:=:=:=:=
:=:=:=:=but when you put this in the source it throws an error
:=:=:=It would do.
:=:=:='xd8', is a label, and you will get an undefined label error (unless you have something defined called 'xd8'). The syntax for a hexadecimal number, is '0xd8', which will work fine.
:=:=
:=:=Sorry I did not explain enough the xd8 shows that it is using the access bank to do fast ram read and write the actual address of the status is 0xfd8 but when you use the access bank addressing you do not need to put the F at the begining however although there is a tempting glimpse of it in the documetation I cannot see anyway of getting it working from my source. See #asm in help file pic 18
:=:=
:=:=bcf f,b,a - does a mean access or what it is not defined
:=
:=You are missing the point of my reply. You are actually complaining about the wrong error. :-)
:=
:=You cannot use the syntax 'xf8', because this will be seen as a variable, not an address. This has to be preceeded with the '0', to tell the compiler that this is an address. The code fed into the compiler has to use the 'C' syntax, rather than assembler syntax.
:=Now the actual syntax of the assembler required for the access bank, is defined in the Microchip data sheet, with a=0, implying access bank, and a=1, implying to use the BSR. This value goes into bit 0 of the MSByte of the resulting instruction. If you look at the hex output that is generated for the code.
:=The required syntax to correctly override the access bank, then would be:
:=#asm
:= bcf 0xd8,0,0
:=#endasm
:=
:=The instruction:
:=#asm
:= bcf 0xd8,0
:=#endasm
:=Will produce exactly the same assembler as you show...
:=
:=Unfortunately, the compiler does not (yet) recognise the second ',0', and instead complains on this (not on the 'xd8').
:=So the point is that your 'example' given, is failing, because you are trying the wrong thing (xd8), not because of the access bank...
:=
:=I had the same problem some time ago, with the internal compiler not handling the 'RETFIE 1' syntax, again despite the help file showing the full syntax. I complained about this to CCS (and in the meantime just coded round it by using the #rom directive to put the correct byte in the location). CCS fixed this very quickly, and do now accept this syntax.
:=
:=Try actually inputing what I showed. This doesn't give the access bank override, but is compatible with what CCS are generating at present.

Thanks for the help. I knew that the correct address was 0x?? but it was how I was suppposed to make it use the access bank that was the problem for me. However you have answered the question in the first part of this reply. all we have to do now is get the compiler to use it!! thanks again
___________________________
This message was ported from CCS's old forum
Original Post ID: 9951
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