Easy to do with almost all RTC and a external EEPROM, or skip the RTC and use ElapsedTimer example.
Easy to do with almost all RTC and a external EEPROM, or skip the RTC and use ElapsedTimer example.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I don't understand your reply and is it not possible to impliment solution with a single chip?
Do a 16F84 not have enough data space?
Rgds
Sure it do (does...) have enough data space...
If you want to record 64 events, each of which are only one byte wide data, or 32 events of 2 byte data, or 16 events of 4 byte data, or 8 events of 8 byte data, or 4 events of 16 byte data, or 2 events of 32 byte data, or one event of 64 byte data.
See where I'm going with this?
We don't know: what you are logging (A) and how often you are logging it (B).
A x B = total data space required.
Some simple math and a quick trip to the datasheets will answer all your questions.
As a complete NOOB I am struggling again, my interrupt handler doesn't work. It's for a timer
and this code is only part of the complete project. It should pulse portb.0 and susequently portb.2 It does not work. Please help if you have the time. Rgds Mike
'Using 16F628 4MHz crystal
secs var byte
mins var byte
clear
option_reg = %10000111
intcon = %10110010
test:
on interrupt goto seconds
goto test
disable
seconds: 'Interrupt Handler 'Disable interrupts during Handler
secs=secs+1
intcon.2=0 'interrupt bit 2 must be rest in software
if secs=10 then
mins=mins+1
secs=0
high portb.0
pause 1
low portb.0
endif
if mins=5 then gosub minutes
resume test
enable 'Re-enable interrupts after Handling
minutes:
mins=0
intcon.2=0
secs=0
high portb.2
pause 5
low portb.2
return
The setup is a bit goofy in my mind, but if it works for you, great...
This is the way I'd do it (keep in mind I don't have my 'stuff' handy, so the register setup might be off)
Again, check your pulse length on the LED flash. Increase it maybe.Code:secs var byte : mins var byte : dummycounter var byte clear option_reg = %10000111 : intcon = %10110010 goto skip_ints_and_subs on interrupt goto int_handle disable int_handle: intcon.2 = 0 secs = secs + 1 if secs = 10 then mins = mins + 1 : secs = 0 : high portb.0 : pause 1 : low portb.0 '1ms? sure you'll see the pulse? endif if mins = 5 then mins = 0 : secs = 0 : high portb.2 : pause 5 : low portb.2 '5ms? probably won't see this pulse either endif resume enable skip_ints_and_subs: dummycounter = dummycounter + 1 goto skip_ints_and_subs
if secs = 10 then
mins = mins + 1
Did you mean:-
if secs = 60 then
mins = mins + 1
... Steve
Nope...if the O/P put 10 and his minutes are 10 seconds long, then great...
Besides...if you're making something, and something else isn't working...I don't know about you, but I'd rather wait 10 seconds to see if something doesn't work rather than 60 of them seconds.
Can always change it later...
Thanks for your help with my project, it is now almost complete and working well enough.
In the end I didn't use an Interrupt Handler, just counted until intcon.2=1, fairly accurate for what I want, about +-0.02%, according to my real time clock.
I've packaged the result as a demo, hoping to strike up some interest with a few of my chums...you never know?
Rgds
Mike
Bookmarks