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 CCS Technical Support

Writing to register

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



Joined: 26 May 2005
Posts: 10

View user's profile Send private message

Writing to register
PostPosted: Thu Jun 02, 2005 5:26 am     Reply with quote

i want to know how can i write write directly to register such as sspstat,sspcon1 etc ....
i remind you i'm using pic 184550.
thanks
valemike
Guest







PostPosted: Thu Jun 02, 2005 5:57 am     Reply with quote

You need to define these registers using the #byte directive:

For example, i'm using the PIC18F458, and the register addresses are:

#byte PIC_SSPBUF = 0xFC9
#byte PIC_SSPADD = 0xFC8
#byte PIC_SSPSTAT = 0xFC7
#byte PIC_SSPCON1 = 0xFC6
#byte PIC_SSPCON2 = 0xFC5

Do the above defines in the beginning of your .c file.

Then you would address them just like you do other variables:

e.g.

PIC_SSPSTAT = 0x23; // writes the value 0x23 to PIC_SSPSTAT

To read PIC_SSPADD:

int8 this_byte;
...
this_byte = PIC_SSPADD
seven



Joined: 26 May 2005
Posts: 10

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 6:06 am     Reply with quote

thank you!
My problem is i can"t locate those registers.
could you help to find them for PIC 18F4550?
valemike
Guest







PostPosted: Thu Jun 02, 2005 6:12 am     Reply with quote

Page 66 of the .pdf datasheet of the PIC18F4550 shows a chart where all these values are.

You have to navigate thru the Microchip.com website to find each specific device's datasheet. For the pic18f4550, it's here:

http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1335&dDocName=en010300
valemike
Guest







PostPosted: Thu Jun 02, 2005 6:14 am     Reply with quote

seven wrote:
thank you!
My problem is i can"t locate those registers.
could you help to find them for PIC 18F4550?


p.s. Look at the previous post today where you asked about how to map SSPSTAT, SSPCON1, etc. I gave an example in that thread.
seven



Joined: 26 May 2005
Posts: 10

View user's profile Send private message

PostPosted: Thu Jun 02, 2005 6:16 am     Reply with quote

valemike wrote:
seven wrote:
thank you!
My problem is i can"t locate those registers.
could you help to find them for PIC 18F4550?


p.s. Look at the previous post today where you asked about how to map SSPSTAT, SSPCON1, etc. I gave an example in that thread.


Thank you,
I actually found it on page 68 (SFR).
In fact i have found sspcon and i believed that other register witll be near from it. I look every where around and i find the other registers i need.
So thank you very much.
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