how can i use GPRs from other banks in CCS C compiler?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514948
Pete Smith Guest
Re: ram in pic16c77
Posted: Mon Jun 02, 2003 9:32 am
:=how can i use GPRs from other banks in CCS C compiler?
Do you mean explicitly, i.e. you want to access the 10th register in bank 3, or do you just want to be able to use all the RAM?
If it's the latter, use *=16 in your #device line e.g.
#device PIC16F877 *=16
If it's the former, then you can just do something like
#byte EECON2 = 0x18d
and then
EECON2=0x55
The compiler takes care of everything for you.
HTH
Pete.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514958
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Re: ram in pic16c77
Posted: Mon Jun 02, 2003 12:13 pm
:=how can i use GPRs from other banks in CCS C compiler?
--------------------------------------------------------
You need to add the following statement to your program.
Make sure you put it as the next line after your #include
statement.
<PRE>
#include <16c77.h>
#device *=16 // <-- Add this statement
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514968
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Re: ram in pic16c77
Posted: Mon Jun 02, 2003 6:37 pm
:=how can i use GPRs from other banks in CCS C compiler?
------------------------------------------------------------
You need to use the #device *=16 directive. Like this:
#include <16c77.h>
#device *=16
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514982
Woody Guest
Re: ram in pic16c77
Posted: Tue Jun 03, 2003 2:58 am
I'm not that familiar with the pic16c177. However:-
The CCS compiler defaults to 8bit pointers which limits the ram access to 0xff. (The first two banks)
There are two ways to access ram above this limit.
1) Declare pointers to be 16bit by including the following compiler directive. (This generally results in larger code due to the addition of all the bank switching code required.)
#pragma device *=16
2) Use the biult in library functions to access the ram above 0xff. (This usuually results in less code but can be comparatively slower.)
read_bank()
write_bank()
All of this is documented in the CCS compiler manual.
Hope this helps
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514995
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