Hi Peeps,
I searched but didn't find quite what I need help with: I'd like to find a GCGB example that uses clock to measure real time, as in, Hr,Mn,Sec. I'd like to keep my program looping until x minutes have passed. Can anyone point me to some tread, or example for this.
Thanks mucho!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Clock accuracy is not all that important. I am measuring temperatures in a continuous loop. I want to time certain events during the loop, such as, how long two sensors are more than x degrees apart, so I do not want to use wait. I want to use the internal clock with 6MHz external resonator and learn how to read the clock registers and accumulate time increments to become seconds and so on. The Help examples are real short and too ambiguous for a beginner like me. I'm wondering if anyone has code segments that show precisely what I'm looking for.
THanks, and I have to say that this forum is very very good and friendly. THANKS!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Look at this program using wait.
Also look at the example data logger on the GCBASIC main website
#chip 16F886,8 'model, speed
#define green PORTB.0
dir PORTA.0 in
dir PORTB.0 out
dir PORTB.1 out
secs = 0
mins = 0
hrs = 0
outofrange = 0 ' timer
' flash a light on and off every half a second = one sec scan
FlashLight:
SET green ON 'Turn on the light
WAIT 50 10ms 'Wait for 50 x 10 (500) milliseconds
SET green OFF 'Turn off the light
WAIT 50 10ms 'Wait for 50 x 10 (500) milliseconds
' Real time clock hrs,mins,secs
secs = secs +1 'Increment seconds counter
If secs > 59 then
mins=mins + 1
secs = 0
' keep track minutes of temperature too high
if ReadAD(AN0) > 120 then outofrange = outofrange +1
end if
If mins > 59 then
hrs=hrs + 1
mins = 0
end if
GOTO FlashLight
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Peeps,
I searched but didn't find quite what I need help with: I'd like to find a GCGB example that uses clock to measure real time, as in, Hr,Mn,Sec. I'd like to keep my program looping until x minutes have passed. Can anyone point me to some tread, or example for this.
Thanks mucho!
how accurate and how long do you want to go?
simplest solution is a "wait" statement and some counters for sec, min,hours.
solution 2 is an external 32khz crystal on timer1 for a 1 sec interrupt.
solution 3 is an external clock chip like a 1302 or 1307
Clock accuracy is not all that important. I am measuring temperatures in a continuous loop. I want to time certain events during the loop, such as, how long two sensors are more than x degrees apart, so I do not want to use wait. I want to use the internal clock with 6MHz external resonator and learn how to read the clock registers and accumulate time increments to become seconds and so on. The Help examples are real short and too ambiguous for a beginner like me. I'm wondering if anyone has code segments that show precisely what I'm looking for.
THanks, and I have to say that this forum is very very good and friendly. THANKS!
Look at this program using wait.
Also look at the example data logger on the GCBASIC main website
Oh cool. Thanks, I'm on it!