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

ram in pic16c77

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







ram in pic16c77
PostPosted: Mon Jun 02, 2003 4:50 am     Reply with quote

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
PostPosted: Mon Jun 02, 2003 9:32 am     Reply with quote

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

View user's profile Send private message

Re: ram in pic16c77
PostPosted: Mon Jun 02, 2003 12:13 pm     Reply with quote

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

View user's profile Send private message

Re: ram in pic16c77
PostPosted: Mon Jun 02, 2003 6:37 pm     Reply with quote

:=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
PostPosted: Tue Jun 03, 2003 2:58 am     Reply with quote

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
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