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

Brown out reset

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







Brown out reset
PostPosted: Mon Oct 01, 2007 12:08 pm     Reply with quote

Hi All,
I am using a PIC16F688 and from what I understand, by reading the datasheet, is that the brown-out reset can be enabled or disabled by software. Does this mean I can enable/disable it in the "main program"?
If so what would be the command for this? I looked at the CCS help but can't find it.
Thanks for the help.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 12:28 pm     Reply with quote

There's a fuse setting for it. It's in the 16F688.H file.
Code:
#fuses SBODEN


That enables the feature. I don't think there's a CCS function to turn it
on/off in software. You have to write directly to the register bit.
You can use a #bit statement to declare the address of the PCON register
and the bit position of the SBODEN bit within it. Then you can write
a line of code in main(), and set the SBODEN bit to 0 or 1, as required.

Look in this section of the data sheet to find the address of the PCON
register and the bit position of the SBODEN bit.
Quote:
PIC16F688 SPECIAL FUNCTION REGISTERS SUMMARY BANK 1
Guitarplayer
Guest







PostPosted: Mon Oct 01, 2007 1:03 pm     Reply with quote

Ok, the datasheets says the address of PCON register is 8Eh and the SBOREN is Bit5 of the PCON register.
So the code would look like this:?
declaration:
#bit BOR=0x8E.5
enabling the brownout-reset:
BOR=1;

Thanks for the input!
Guitarplayer
Guest







PostPosted: Mon Oct 01, 2007 1:07 pm     Reply with quote

Forgot to mention that the fuse for the software controlled brown out reset for my CCS compiler is:
#FUSES BROWNOUT_SW
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Oct 01, 2007 1:13 pm     Reply with quote

The latest 16F688 data sheet shows that SBOREN is bit 4 of the PCON
register, not bit 5.

Here's a link to the data sheet. See page 12 in the Acrobat reader:
http://ww1.microchip.com/downloads/en/DeviceDoc/41203D.pdf
Guitarplayer
Guest







PostPosted: Mon Oct 01, 2007 1:30 pm     Reply with quote

Thanks for the remark. I realized that as I was trying to test that feature and went back to the datasheet only to find out that it was bit 4 and not bit5.

Thanks again! It works now! Greatly appreciate the help!
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Tue Oct 02, 2007 4:06 am     Reply with quote

I have a related question.
If I got it right, brownout is a power voltage level condition, under this voltage level the PIC's operation becomes unstable/unpredictable, isn't it ?
I just keep thinking what might be the reasons for not enabling the brownout reset function in my applications...
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Wed Oct 03, 2007 7:41 am     Reply with quote

The low voltage versions of pic chips can still operate down to 2v. So if someone wants their program to still function they need to disable the reset.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Oct 03, 2007 9:42 am     Reply with quote

libor wrote:
I have a related question.
If I got it right, brownout is a power voltage level condition, under this voltage level the PIC's operation becomes unstable/unpredictable, isn't it ?
I just keep thinking what might be the reasons for not enabling the brownout reset function in my applications...
The only reason I can think of for disabling the BOR is for power saving reasons (about 50uA on the PIC18F458 (old model) and PIC18F8722 (nanowatt)). Note that the BOR is sharing large portions of circuitry with the LVD module which has to be disabled as well for this power saving to be achieved.

I rather have a stable processor than saving a tiny bit of power so have BOR always enabled.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Wed Oct 03, 2007 11:30 am     Reply with quote

If you handle the brown out situation yourself, then you may want the extra time to say,
save some settings to eprom.
This is a time you wouldn't want the pic to reset.
you want the max run time possible.

just a thought
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