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

Modifying Configuration Registers

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



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Modifying Configuration Registers
PostPosted: Tue Nov 01, 2005 2:52 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 01, 2005 3:05 pm     Reply with quote

Quote:
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.

See this thread:
http://www.ccsinfo.com/forum/viewtopic.php?t=5837&highlight=byte+bit+uart


Also, CCS has a function which can be used to disable the hardware UART:
Code:
setup_uart(FALSE);
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Tue Nov 01, 2005 3:21 pm     Reply with quote

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

View user's profile Send private message Send e-mail Yahoo Messenger

Re: Modifying Configuration Registers
PostPosted: Tue Nov 01, 2005 3:24 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 01, 2005 3:32 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Nov 01, 2005 7:44 pm     Reply with quote

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