Pages: 1 2 [3]   Go Down
Author Topic: Clock with Arduino  (Read 6791 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

are you using 0018?

version 0017 disabled interrupts in delayMicroseconds and the LCD library does use this function.

Sounds like that may be the cause of you problem. Try it with 0018 if you are not yet using that.
« Last Edit: February 09, 2010, 10:30:39 am by mem » Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I've read that the LCD library disables and re-enables interrupts. Maybe that's why millis is not keeping an accurate count.
Logged

UK
Offline Offline
Faraday Member
**
Karma: 17
Posts: 2884
Gorm deficient
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
think I've read that the LCD library disables and re-enables interrupts

Can't think of any good reason why it should.  :o

Some delays, certainly, but the rest is just "digitalWrite"s
« Last Edit: February 09, 2010, 10:39:05 am by GrooveFlotilla » Logged

Per Arduino ad Astra

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It was a side affect of the way delayMicroseconds works that has been fixed in arduino release 0018
Logged

Madison, WI
Offline Offline
Newbie
*
Karma: 0
Posts: 48
Exploring Electrons. . .
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

mem - you sir win a cookie.  I upgraded to v18 and it is now running perfectly.  I'll have to try my original code with the rest of the software but the timer works fine now  smiley-grin
Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good to hear you have it working.

btw, the code posted in reply #14 has the advantage that is uses fewer variables and uses less processing time (it does two additions each second rather than two divisions each time through the loop).
Logged

Pages: 1 2 [3]   Go Up
Jump to: