Alarms with Mel's "Olympic Timer" based timer - how to?
Hi there,
I'm stuck in trying to make a multiple alarms-timer based on Melanie's "Olympic Timer".
Doing it the way it is here, the timer will mess-up and the sound stop only after a little time (20 to 40 seconds).
This is probably due to the SOUND command witch takes to much time to execute and blocks the interrupt count or so.
I have the feeling it is not possible to get this working this way.
Can anybody confirm?
I think, I'll better go for a RTC (yes/no)?
Code:
' Fuses
@ DEVICE PIC12F675, XT_OSC ;Xtal 4MHz
@ DEVICE PIC12F675, WDT_OFF
@ DEVICE PIC12F675, PWRT_OFF
@ DEVICE PIC12F675, MCLR_ON
@ DEVICE PIC12F675, BOD_OFF
@ DEVICE PIC12F675, PROTECT_OFF
@ DEVICE PIC12F675, CPD_OFF
'-------------------------------------------------------------------------------
' Registers 76543210
CMCON = %00000111 'Comparator OFF
ANSEL = %00000000 'Analog/Digital ports
OPTION_REG = %00000101 'Pull-Ups ENabled, TMR0 prescaler 1:64=16.384 ms
INTCON = %10100000 'GPIO.2 External Interrupt enabled
GPIO = %00000000 'Ports High/Low
TRISIO = %00000000 'Set Input/Output
'-------------------------------------------------------------------------------
' Variables
Ticks var byte
Second var byte
Minute var byte
Hour var byte
Buzzer var GPIO.2
DOutPin var GPIO.1
Update var byte
second = 0
Minute = 0
hour = 0
Update = 0
'-------------------------------------------------------------------------------
' Program
On Interrupt Goto tick_int
MAIN:
if Update = 1 then
update = 0
if second = 0 and minute = 9 and hour = 0 then goto beep1
if second = 0 and minute = 27 and hour = 0 then goto beep1
endif
BEEP1:
sound buzzer,[100,10,50,10]
goto main
end
'-------------------------------------------------------------------------------
' Time Counter - Interrupt Service Routine to handle each timer tick
disable ' Disable interrupts during interrupt handler (or ISR)
TICK_INT:
Ticks = Ticks + 1 'Count pieces of seconds
If Ticks < 61 Then TICK_INT_RESET 'Continue count
' if Ticks >= 61, 1 second elasped => update time
Ticks = 0
Second = Second + 1
If Second >= 60 Then
Second = 0
minute = minute + 1
If minute >= 60 Then
minute = 0
Hour = Hour + 1
Endif
Endif
Update = 1
TICK_INT_RESET:
INTCON.2 = 0 'Reset timer interrupt flag and continue de Ticks count
Resume
enable
Nice to hear from you again Melanie
Quote:
Originally Posted by
Melanie
I rarely have time Peter, but I do click the link every now and again.
Basically, like the Olympic Timer in this thread, if it's going to take longer than about 10mS (length of time to down half a cup of coffee), then no.
Wow!, Welcome back Melanie. I thought you transferred to another forum.
Just like what you said, I too rarely do replies however I check and read the mails of those senders that makes impact in this forum and you are one on them.
Nice to hear from you again.
Thanks,
Nesty
Hmm. Ok then Mel. So now aimed at anyone in the manufacturing sector....
Since 1973, (old, aint I?) I have been in the security industry. The greater majority concentrating on alarms in Banks.
Even today I find that almost all alarms can be defeated with a couple of bucks worth of components. (which I won't go into here)
Just how does one find and interest a manufacturer to look at a high security module, capable of adding to virtually ANY alarm panel which will go a long way to overcoming the above mentioned shortcomings of existing systems. I am not sure if there is anyone out there with a face I can trust (except for Mel, of course (suck, suck)) who may be in a position to perhaps look at / evaluate this device without me having to worry about it being knocked off, something I have experienced before.
I would be happy to discuss my thoughts, privately off forum with someone who may be interested.
Regards and thanks.