Pages: [1]   Go Down
Author Topic: How to attach a function() that will initiate when BOD level is reached?  (Read 732 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How to attach a function() that will initiate when BOD level is reached? I need to make sure some peripherals turn off before BOD level is reached... Thanks
Logged

Maryland, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think that is possible, the whole point of BOD is to hold the chip in RESET mode until the voltage is high enough to safely run.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4092
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure this is possible, the BOD just forces the MCU into reset and holds it there as long as voltage is too low. The whole point is to stop execution under conditions that could cause invalid results.

If by peripherals you mean circuitry not contained within the MCU, then perhaps monitoring the supply voltage with an analog input would work.
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah that is a good choice. It would be nice to be able to use BOD as interrupt. I am sure there are many applications that could benefit from that option.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 227
Posts: 6637
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you especially want an interrupt when the power supply voltage drops, you could use the analog comparator and a voltage divider to monitor the supply voltage.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Offline Offline
Jr. Member
**
Karma: 0
Posts: 68
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I ended up using an N channel MOSFET, so when the BOD level is reached, it by default sets the pin low, turning what I need off.

But yes I think that would be the next best thing ^...

How exactly do you do that? I am sure I will need to do that at some point in the future...
« Last Edit: May 16, 2012, 06:32:33 pm by bamboosam » Logged

Maryland, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 162
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Random side note, been reading in depth about the TI MSP430 mcu (i.e. the TI LaunchPad and its big brothers) and believe it or not it does have a way of doing this, called the SVS (Supply Voltage Supervisor).  Trigger voltage tweakable in software, its comparator output is accessible in software and it can be configured to issue a power-on-reset or just run an interrupt routine.  I think you can make it read a different voltage than Vcc if the model of mcu breaks out a pin for it.  Not sure if that's usable in the "value line" supported by the LaunchPad. edit: looks like it's not, guess that comes in higher end models.
« Last Edit: May 16, 2012, 07:51:31 pm by spirilis » Logged

Pages: [1]   Go Up
Jump to: