From PICLIST@MITVMA.MIT.EDU Thu Nov 14 14:27:15 2002 Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-7.13) id A34317FD0068; Thu, 14 Nov 2002 14:27:15 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <17.007D9775@cherry.ease.lsoft.com>; Thu, 14 Nov 2002 17:13:17 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8d) with spool id 3197 for PICLIST@MITVMA.MIT.EDU; Thu, 14 Nov 2002 17:13:10 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 3347; Thu, 14 Nov 2002 17:12:47 -0500 Received: from *unknown [65.112.57.227] by mitvma.mit.edu (IBM VM SMTP Level 320) via TCP with ESMTP ; Thu, 14 Nov 2002 17:12:47 EST X-Warning: mitvma.mit.edu: Host *unknown claimed to be webmail.saltonusa.com MIME-Version: 1.0 X-Mailer: Lotus Notes Release 5.0.10 March 22, 2002 X-MIMETrack: Serialize by Router on NOTES/SALTON(Release 5.0.10 |March 22, 2002) at 11/14/2002 04:13:25 PM, Serialize complete at 11/14/2002 04:13:25 PM Content-Type: text/plain; charset="us-ascii" Message-ID: Date: Thu, 14 Nov 2002 16:13:10 -0600 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: llile@SALTONUSA.COM Subject: Re: [PIC]: Now, exactly what use is the BOR bit? To: PICLIST@MITVMA.MIT.EDU X-RCPT-TO: Status: R X-UIDL: 277600521 X-Evolution-Source: pop://mailinglist%40farcite.net@mail.farcite.net/ X-Evolution: 000006ed-0000 (testing for cold boot vs all other kinds) Although the manual claims that STATUS,TO should be 1 after power-up, I am finding it is always zero when I first plug in my device. This bit is supposed to be zero only after a WDT. Hmmm, this is getting fishier and fishier. It still looks like the POR bit will give me the info I need, or will it? I am not real confident this is the right answer, though. -- Lawrence Lile llile@SALTONUSA.COM Sent by: pic microcontroller discussion list 11/14/02 03:53 PM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: [PIC]: Now, exactly what use is the BOR bit? The BOR bit, bit 0 of the PCON register in the 16F core, is purportedly used to detect brownout conditions. It is also "Unknown on POR" Now, if you start up your PIC, and test BOR to find out if you were in a brownout, but it is in an unknown state, then what use is it? If you set it in software, then reboot for some reason, and test it, then still, what use is it since it can be either a 1 or zero on startup? The book says that BOR must be set by the user and checked on subsequent resets. Now, how does one tell if it is a subsequent reset, or the first one? If you start up, how do you know if it is a subsequent reset, or just the first time your code has ever seen the light of day? This seems to be one of those catch-22 situations: "we can tell if it is a brownout reset only if you already know it is a brownout reset." Hmmm.. The POR bit seems a little more straightforward: If it is 0 on startup, there was a power-on-reset. You then set it to 1 and it will remain 1 after the next watchdog reset or MCLR reset, but will go back to zero on a cold boot. I am trying to distinguish between a cold boot, and anything else (WDT timeout, MCLR reset, PC counter in the weed patch, Brownout). On a cold boot I'd like to execute my program, in any other condition I'd like to shut off the machine. Any of these conditions besides a warm boot is abnormal in my situation, and I want the PIC to kill off it's power. It looks like to do this I could test for Status, TO = 1 and PCON, POR = 0, then set PCON,POR to 1. If it boots in any other state there must be a problem. But do I miss information about brownout? Is it possible to reboot after a brownout condition and not be caught by this test? It seems the POR bit duplicates the functionality of the Status, TO bit. -- Lawrence Lile Senior Project Engineer Toastmaster, Inc. Division of Salton, Inc. 573-446-5661 voice 573-446-5676 fax -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics