View previous topic :: View next topic |
Author |
Message |
gilson163
Joined: 30 Sep 2015 Posts: 35
|
Posted: Tue Mar 15, 2016 9:28 pm Post subject: BODLEVEL (<4VDC) in Atmega64 |
|
|
Hello friends,
I use atmega 64 and need to run a sub routine when the voltage drops of 4,2VDC . How do I call this subroutine using BODLEVEL = 0 ( 4VDC ) and BODEN = 0 , or how do I BORF the flag to call a subroutine .
Thank you,
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
Visovian
Joined: 31 Oct 2007 Posts: 584 Location: Czech
|
Posted: Tue Mar 15, 2016 10:26 pm Post subject: |
|
|
You cannot do it with BOD.
You have to monitor Vcc with e.g. ADC and when it drops, run the Sub.
You will need a capacitor on Vcc big enough to feed the AVR till the Sub is finished. |
|
Back to top |
|
|
olhexy
Joined: 03 Apr 2011 Posts: 192 Location: Tilburg, Netherlands
|
Posted: Tue Mar 15, 2016 10:34 pm Post subject: |
|
|
I have not much hard experience with this, but will try to think with you.
http://www.atmel.com/images/atmel-2490-8-bit-avr-microcontroller-atmega64-l_datasheet.pdf
I am not sure what you want to do with the subroutine, because BOD will do a reset.
But you mention the BORF.
I think that this flag reads =0 (zero) if the MCU is started by a hard reset at the RESET pin.
If voltage conditions are bad then BOD can (repeatedly) trigger a new reset, and this sets the BORF=1.
After the start was finally succesfull you can read the BORF, so at least you can know that a Brown Out Reset happened.
Is your problem how to read the BORF?
Last edited by olhexy on Tue Mar 15, 2016 10:37 pm; edited 1 time in total |
|
Back to top |
|
|
gilson163
Joined: 30 Sep 2015 Posts: 35
|
Posted: Tue Mar 15, 2016 10:37 pm Post subject: |
|
|
I understand , sorry I'm starting in atmega . So there is no way to link the BOD with a sub routina ? Or use a capacitor as you said to me , or a zero cross ( VAC ) in a INT .
Thank you for your help |
|
Back to top |
|
|
gilson163
Joined: 30 Sep 2015 Posts: 35
|
Posted: Tue Mar 15, 2016 10:43 pm Post subject: |
|
|
No, my problem is not read BORF . My problem and identify V < 4VDC and call and execute a subroutine before the uP reset to save some variables of the process. If someone has another solution thank . |
|
Back to top |
|
|
kimmi
Joined: 24 Feb 2006 Posts: 1922 Location: Denmark
|
Posted: Tue Mar 15, 2016 10:46 pm Post subject: |
|
|
read this post
if you need to save data maby this will help you link to post _________________ / Kim |
|
Back to top |
|
|
|