"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Hi Kamikaze47,
I have an idea of unknown value, having not tried it myself yet.
Open a new page in PBP and write only Define OSC 4, save it and compile, then open the asm file to see what it wrote, print the page, change the define to other numbers and repeat. Do this so you have several copies to compare, and you might get enough information to manually edit your projects asm file, then you could run that through MPASM. Anyway . . . just an idea.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
good idea, i'll give it a try
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
no luck... it seems to just change DEFINE OSC 4 into #DEFINE OSC 4
lol
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
Just let PB think it is running at 4mhz. Calculate what it is really running at for pauses and such. Just like is you had a 8 and told PB it had a 4. Everything would be twice as fast.
Dave
Always wear safety glasses while programming.
Wayyyyyy to many macro's to mess with to get that too work! But, it is an idea...if a guy has that sort of time!
Power saving...there is an internal 31-ish khz backup to the backup to the backup oscillator (I think, don't have datasheets on hand, not ambitious enough to look them up).
But it's not accurate enough to keep any time.
Easiest thing in my mind is to get an 8pin RTC, DS1602 type and use that. Then you can put the PIC to sleep and have it wake itself up every roughly XX number of seconds using the WDT timer and the WDT prescaler.
Internal oscillator does saves power, for comparisons sake, 2x the power.
Running slowly saves power, say 4x the power.
Putting it to sleep saves LOADS of power, say 1000x the power when compared to the other methods.
In the circuit I'm playing with at the house: PIC18F4685 @ 40Mhz (10Mhz external plus 4xPLL) = about 45mA, like the datasheet says. Running it at 8Mhz internal OSC = about 20mA (little high, but close enough to the datasheet), run it on the 31Khz backup oscillator = roughly 5mA with nothing else going on (tight loop only)...
BUT...put it to sleep and the mA doesn't even read. It bounces back and forth between zero and one mA.
Last edited by skimask; - 18th June 2008 at 18:03.
I think this is absolutely the easiest, perhaps the most accurate way of doing it too, especially since you need the LCD to light up only on manual intervention. I have not used the DS1602, but I have used the Philips PCF 8563, and the current draw is almost immeasurable.
Regards,
Anand
I do not agree with using an RTC unless your project dictates it. The option of using the WDT(watchdog timer) to wake you from sleep, keep time and sleep again is the best. I use it in my battery powered security system. Use the Prescalar and WDT to decide at what interval you want to wake.
Of course, you will need to rewrite your code if you have written the timing loops using pause.
Hi,
Find here an asm example that counts down ( 180 days ! ) ... !
sooo simple !
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
At the moment my code has an interrupt every 1 second using a timer and keeps track that way. I assume that the timer does not continue while in sleep mode, so when you say "wake you from sleep, keep time and sleep again", how does it keep time? Just by adding a constant to a timer every time it wakes up? How accurate would you think that would be over a longer period of time?
I'm hoping to get an accuracy of +/- 1 min in 30 days.
"I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams
The Timer1 oscillator will continue running while the chip is in sleep mode.
With a 32768hz crystal, you'll get an interrupt every 2 seconds. (More accurate than the main crystal)
When the PIC wakes up (at the normal OSC speed), you simply update the time then go back to sleep. Batterys will last months.
You don't actually need to use interrupts. If the GIE bit is clear, it will just resume where it left off, so it never leaves the main loop.
DT
Bookmarks