View previous topic :: View next topic |
Author |
Message |
seven
Joined: 26 May 2005 Posts: 10
|
Writing to register |
Posted: Thu Jun 02, 2005 5:26 am |
|
|
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
|
|
Posted: Thu Jun 02, 2005 5:57 am |
|
|
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
|
|
Posted: Thu Jun 02, 2005 6:06 am |
|
|
thank you!
My problem is i can"t locate those registers.
could you help to find them for PIC 18F4550? |
|
|
valemike Guest
|
|
|
valemike Guest
|
|
Posted: Thu Jun 02, 2005 6:14 am |
|
|
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
|
|
Posted: Thu Jun 02, 2005 6:16 am |
|
|
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. |
|
|
|