View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
Modifying Configuration Registers |
Posted: Tue Nov 01, 2005 2:52 pm |
|
|
Hello All,
In my quest for low power during sleep I'm going to disable the UART and MSSP and make the pins outputs.
I was able to find the address of the registers that will allow me to disable the hardware, But I'm unsure of how to modify them.
Do I use the write_program_memory() function?
I tried searching the forum here and was unsuccessful.
Thanks in advance,
John |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Tue Nov 01, 2005 3:21 pm |
|
|
Thanks PCM.
I had not seen the post that you linked. I should be able to figure that out. I'm gradually getting deeper into C, and it's instances like this that force me to learn a new trick....
The setup_uart() function with the FALSE argument is puzzling. Apparently it is one of those undocumented features? I couldn't find that in the latest manual (the FALSE argument that is). Is it detailed in some place other than the description of the function? (I ask because I may be missing other goodies like that.)
Thanks again, I'll start testing all of this when I get my new uAmmeter on Thursday from Digikey.
John |
|
|
MikeValencia
Joined: 04 Aug 2004 Posts: 238 Location: Chicago
|
Re: Modifying Configuration Registers |
Posted: Tue Nov 01, 2005 3:24 pm |
|
|
jecottrell wrote: | Hello All,
In my quest for low power during sleep I'm going to disable the UART and MSSP and make the pins outputs.
I was able to find the address of the registers that will allow me to disable the hardware, But I'm unsure of how to modify them.
Do I use the write_program_memory() function?
I tried searching the forum here and was unsuccessful.
Thanks in advance,
John |
Since you say that you know the registers' addresses, let's say they are registers MIKE1, MIKE2, MIKE3, at addresses 0xF80, 0xF81, and 0xF82, respectively.
Then you define the following:
#byte MIKE1=0xf80
#byte MIKE2=0xf81
#byte MIKE3=0xf82
You can now modify these variables:
e.g.
MIKE1 = 0x00; |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Nov 01, 2005 3:32 pm |
|
|
Quote: | The setup_uart() function with the FALSE argument is puzzling.
Apparently it is one of those undocumented features? I couldn't
find that in the latest manual |
It's in the 16F877.H file:
Quote: |
// Constants used in setup_uart() are:
// FALSE - Turn UART off
// TRUE - Turn UART on
#define UART_ADDRESS 2
#define UART_DATA 4
|
Also, the manual does say this:
Quote: |
SETUP_UART() Function:
Very similar to SET_UART_SPEED.
If 1 is passed as a parameter, the UART is turned on,
and if 0 is passed, UART is turned off. If a BAUD rate
is passed to it, the UART is also turned on, if not already on. |
The 16F877.H file defines TRUE and FALSE as:
Code: | #define FALSE 0
#define TRUE 1 |
|
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Tue Nov 01, 2005 7:44 pm |
|
|
PCM,
I apologize for the serious lack of attention to detail when reading the manual. I was concentrating on the paragraph above where it mentions the use that you quoted. I gave up too quickly after not seeing what I wanted to see.
Thank you for the time and effort on the explanation (very appropriate for someone who has exhibited the density of Osmium in the past.)
Thanks,
John
BTW, Osmium is the densest element. |
|
|
|