EmbeddedRelated.com
Forums

Real Time Clock Code (RTC) for PIC family

Started by tomcee November 17, 2010
On 17/11/2010 20:52, Jan Panteltje wrote:
> On a sunny day (Wed, 17 Nov 2010 20:41:10 +0100) it happened > =?ISO-8859-1?Q?Hans-Bernhard_Br=F6ker?=<HBBroeker@t-online.de> wrote in > <ic1b4k$kjj$03$1@news.t-online.com>: > >> On 17.11.2010 18:40, Jan Panteltje wrote: >> >>> Using a LCD conflicts with 'low power', as a small LCDs often already used a few mA, >> >> You seem to have an entirely different meaning for the term "LCD" in >> mind than --- well, pretty much everybody else. To a rather reasonable >> approximation, LCDs consume no power whatsoever. They're just a >> capacitor that you charge once, and then you top up that charge every >> once in a long while. >> >> Unless you happen to be in the enormously lucky position of having e-ink >> displays at your disposal, or don't want to show what your device is >> doing at all, there's just about no way you'll beat a simple LCD on >> power consumption. > > I just soldered in a 16 x 2 character LCD (Hitachi controller), > and WITHOUT backlight it is almost 2mA. > WITH backlight much much more.
That isn't a bare metal LCD display. The right chipset can do it with a current draw that is not much different to the self discharge rate of the battery. I have done it with a PIC and about 15uA for a 4 digit display (including the current for the CPU itself). The Hitachi controllers are easy to use but not energy efficient. You are into bespoke LCD controller territory for low current work. Though a PIC can be made to drive simple LCD displays directly. Ultra low power displays with many switchable sites requires ePaper technology with no need to periodically refresh the chroma sites. Power there is only needed to switch colour state. Regards, Martin Brown
On Wed, 17 Nov 2010 20:41:10 +0100, Hans-Bernhard Br&#4294967295;ker
<HBBroeker@t-online.de> wrote:

>On 17.11.2010 18:40, Jan Panteltje wrote: > >> Using a LCD conflicts with 'low power', as a small LCDs often already used a few mA, > >You seem to have an entirely different meaning for the term "LCD" in >mind than --- well, pretty much everybody else. To a rather reasonable >approximation, LCDs consume no power whatsoever. They're just a >capacitor that you charge once, and then you top up that charge every >once in a long while.
Yeah, down in the uA range, depending on size, operating voltage, type etc., which might be less than the self-discharge of a smallish battery.
>Unless you happen to be in the enormously lucky position of having e-ink >displays at your disposal, or don't want to show what your device is >doing at all, there's just about no way you'll beat a simple LCD on >power consumption.
JP's probably thinking of an alphanumeric LCD module (like those based on the HD44780 type of controller chip), which indeed uses a mA or more, rather than the 'bare glass' type of LCD (plus current in the bias network, plus a lot more for the backlight, if present).
On 2010-11-17, Martin Brown <|||newspam|||@nezumi.demon.co.uk> wrote:
> A bare LCD is very low current consumption, but you have to generate the > waveforms to drive it directly. It only gets hairy when you want to > multiplex a displays off the rather finite number of IO pins on a PIC.
There are many PICs with easy-to-use, low-power, built-in LCD drivers. -- John W. Temples, III
On Wed, 17 Nov 2010 20:47:58 +0000, Martin Brown
<|||newspam|||@nezumi.demon.co.uk> wrote:

>On 17/11/2010 19:41, Hans-Bernhard Br&#4294967295;ker wrote: >> On 17.11.2010 18:40, Jan Panteltje wrote: >> >>> Using a LCD conflicts with 'low power', as a small LCDs often already >>> used a few mA, >> >> You seem to have an entirely different meaning for the term "LCD" in >> mind than --- well, pretty much everybody else. To a rather reasonable >> approximation, LCDs consume no power whatsoever. They're just a >> capacitor that you charge once, and then you top up that charge every >> once in a long while. > >This is incorrect. An LCD will fade out in a couple of seconds if you >apply DC and may suffer permanent damage if left DC polarised for a long >time. The dark state is when AC is applied to the segment - though a >relatively slow AC signal is enough to do it and power consumption for a >bare metal 4 digit LCD driver is tiny. But you have to use the right low >power driver chipset. > >Jan is thinking of the matrix LCD displays commonly used with PICs that >have an "intelligent" controller and take commands off a 4 or 8 line >bus. They do tend to draw a few mA but are much simpler to control.
It's pretty simple to control _some_ 'bare glass' with _some_ PICs.. especially the ones with built-in LCD controllers (static to quad-plexed). Set up the hardware and it runs, you just have to flip bits for segments on/off. Not enough segments for dot matrix displays, but plenty for segment displays plus some annunciators.
>> >> Unless you happen to be in the enormously lucky position of having e-ink >> displays at your disposal, or don't want to show what your device is >> doing at all, there's just about no way you'll beat a simple LCD on >> power consumption. > >A bare LCD is very low current consumption, but you have to generate the >waveforms to drive it directly. It only gets hairy when you want to >multiplex a displays off the rather finite number of IO pins on a PIC. > >Regards, >Martin Brown
On 17.11.2010 22:01, Michael A. Terrell wrote:

> Wht do you consider reasonable?
A reasonable approximation to "uses no power" is a device that runs on one set of batteries for roughly as long as the stated shelf life of those batteries. LCD-based wrist watches and alarm clocks routinely manage that. TV remotes and pocket calculators often come close.
In article <ic19sm$cqa$1@news.eternal-september.org>,
Jim Stewart  <jstewart@jkmicro.com> wrote:

>I don't know how 90% of the world's digital alarm >clocks work. I just know that I've seen several >60hz-derived clocks over the years and they all >suffered from erratically gaining time from noise >on the line. > >I'm sure that a reliable mains-frequency clock can >be designed. I'm also pretty sure that you can't >do it with a comparator and a few resistors.
The way I'd do it, would be to use a reliable, reasonably-close-to- a-known-frequency oscillator (an off-the-shelf quartz crystal type) as a short-term internal time base, which was then frequency- locked to the power-line input via a periodic sampling (e.g. 60 HZ) via a microcontroller of some sort. Don't use the actual zero-crossing events of the powerline... as you point out, this would be vulnerable to false triggering due to line noise. Instead, implement a software PLL, with a suitable averaging loop time. This technique has an additional benefit. If you run the micro and oscillator from a battery-backed-up power supply, and add a bit of "smarts" to the software, you can automatically disable the PLL tracking whenever the 60 Hz signal goes away, and just do your time-counting based on the current pulse-count rate of the internal oscillator. In effect, you would have a "line-frequency-standard disciplined" quartz crystal oscillator, rather than trying to use the line frequency directly as a timing source. A similar technique is used in the VE2ZAZ frequency standard (and, no doubt, numerous others) which use the slow and jitter-prone "pulse per second" output from a good GPS receiver to discipline a quartz- crystal oscillator. By using an averaging period of an hour or two, you can get *very* close to an exact 10.00000000 MHz signal... and the firmware in the controller will automatically reject any timing samples which further from this rate than a margin you select due to noise or jitter or hardware glitches. -- Dave Platt <dplatt@radagast.org> AE6EO Friends of Jade Warrior home page: http://www.radagast.org/jade-warrior I do _not_ wish to receive unsolicited commercial email, and I will boycott any company which has the gall to send me such ads!
On a sunny day (Wed, 17 Nov 2010 11:23:25 -0800) it happened Tim Wescott
<tim@seemywebsite.com> wrote in
<Au6dnWdGtfK-sXnRnZ2dnUVZ_gidnZ2d@web-ster.com>:

>On 11/17/2010 09:40 AM, Jan Panteltje wrote: >> On a sunny day (Wed, 17 Nov 2010 07:56:13 -0800 (PST)) it happened tomcee >> <tomcees_pc@yahoo.com> wrote in >> <e83dfb22-5c13-4ab0-8aa8-cc5915cfca55@o14g2000yqe.googlegroups.com>: >> >>> Hello: >>> >>> What is the latest RTC code anyone could recommend for the PIC (16f) >>> family? >>> >>> My requirements are simplicity and low power, with LCD display and >>> perhaps RS232 interface. >>> >>> Is the Microchip AN582 as good as it gets? >>> >>> Thanks, >>> TomC >> >> First Microchip application notes often contain errors, >> to the point where example code is simply wrong and obviously never tested in real life. > >As do app notes from many other companies. > >> Using a LCD conflicts with 'low power', as a small LCDs often already used a few mA, > >A module perhaps, but just an LCD display, properly driven, is >exceedingly low power -- or haven't you noticed what digital watches >use, and how long their batteries last?
The subject was PIC, and making LCD scan signals with PIC is not so simple. No body in his sane mind will do that, everybody uses a LCD module with some ASICs on it.
On a sunny day (Wed, 17 Nov 2010 18:50:04 +0000) it happened John Devereux
<john@devereux.me.uk> wrote in <87aal7wzs3.fsf@devereux.me.uk>:

>Jim Stewart <jstewart@jkmicro.com> writes: > >> Rob Gaddi wrote: >> >>> Way too expensive. Just plug into the mains and learn to count to 60 or >>> 50 as the case may be. Doing so without electrocution is left as an >>> exercise for the reader. >> >> Have you ever successfully done this? I ask >> because I've never seen an implementation that >> was more accurate than a $2 crystal and clock >> chip. > >Don't 90% of the worlds digital alarm clocks work like this? I thought >"they" precisely controlled the long term cumulative frequency error of >the mains for this very reason?
I have used 50 Hz from the mains in Europe in a dark room timer in the seventies. It needed a bit of lowpass to get rid of the spikes on teh mains, but was very accurate. Later it was modified and used as a slide show timer... Later I made an other one for a big art project.
On a sunny day (Wed, 17 Nov 2010 16:16:45 -0500) it happened Spehro Pefhany
<speffSNIP@interlogDOTyou.knowwhat> wrote in
<r6h8e61q9s27iai28hqu0psha0c9cfbjtr@4ax.com>:

>On Wed, 17 Nov 2010 20:41:10 +0100, Hans-Bernhard Br&#4294967295;ker ><HBBroeker@t-online.de> wrote: > >>On 17.11.2010 18:40, Jan Panteltje wrote: >> >>> Using a LCD conflicts with 'low power', as a small LCDs often already used a few mA, >> >>You seem to have an entirely different meaning for the term "LCD" in >>mind than --- well, pretty much everybody else. To a rather reasonable >>approximation, LCDs consume no power whatsoever. They're just a >>capacitor that you charge once, and then you top up that charge every >>once in a long while. > >Yeah, down in the uA range, depending on size, operating voltage, type >etc., which might be less than the self-discharge of a smallish >battery. > >>Unless you happen to be in the enormously lucky position of having e-ink >>displays at your disposal, or don't want to show what your device is >>doing at all, there's just about no way you'll beat a simple LCD on >>power consumption. > >JP's probably thinking of an alphanumeric LCD module (like those based >on the HD44780 type of controller chip), which indeed uses a mA or >more, rather than the 'bare glass' type of LCD (plus current in the >bias network, plus a lot more for the backlight, if present).
Yes, Ok sorry to all, I did not know there were PICs with a LCD scanning module build in. I would like to hear what the OP wants, backlight? For many applications backlight is a must.
Hans-Bernhard Br&#4294967295;ker wrote:
> > On 17.11.2010 22:01, Michael A. Terrell wrote: > > > Wht do you consider reasonable? > > A reasonable approximation to "uses no power" is a device that runs on > one set of batteries for roughly as long as the stated shelf life of > those batteries. LCD-based wrist watches and alarm clocks routinely > manage that.
Really? Watch batteries last me about a year. TV remotes and pocket calculators often come close. TV remote batteries last a few months, far short of the three to four year, 'Use By date' on the labels. I normally use solar power calculators, or the one built into every computer I have. -- For the last time: I am not a mad scientist! I m just a very ticked off scientist!!!