Pages: [1]   Go Down
Author Topic: Lack of Timer support for Arduino  (Read 592 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 173
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Would someone explain why there is no support for timers in the core Arduino language?
http://arduino.cc/en/Reference/HomePage

There is an external library here
http://www.arduino.cc/playground/Main/MsTimer2

why isn't this included with the Arduino software?


Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?

Quote
"Install it on {arduino-path}/hardware/libraries/ "

All Arduino libraries on a Windows system are under
\Program Files\Arduino\libraries\

Quote
not \Program Files\Arduino\hardware\libraries
[/color]




Thanks
« Last Edit: November 16, 2011, 03:17:13 pm by cappy2112 » Logged

Newcastle, England
Offline Offline
Sr. Member
****
Karma: 3
Posts: 489
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Timers are an internal piece of hardware found in side the AVR. It is probably assumed that those users capable of using timers properly will not be wanting to use a library like timer2 for it. There are many libraries created that are not included in the arduino software, generally because they are less useful or commonly used. On the other hand, timer2 does provide some very useful extra functions for users unable to use the timers...

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?
Quote
"Install it on {arduino-path}/hardware/libraries/ "

All Arduino libraries on a Windows system are under
\Program Files\Arduino\libraries\

Quote
not \Program Files\Arduino\hardware\libraries

It would appear so. You are able to edit the page, so why not correct it?

Onions.
Logged

My website: http://www.harryrabbit.co.uk/electronics/home.html Up and running now! (Feel free to look round!) smiley-grin

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

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?
Maybe. Maybe not.

Quote
All Arduino libraries on a Windows system are under
Not on my installation of Arduino.

The libraries that were delivered with the Arduino used to be in .\Arduino-xxxx\hardware\libraries. Not all the libraries were specific to hardware, to the library location changed.

Quote
Would someone explain why there is no support for timers in the core Arduino language?
There is plenty of support for all the timers on the Duemilanove/UNO type Arduinos. They each have dedicated functionality, and are not always available for your use. The tone function, for instance, needs a timer. The servo library needs some timers. The PWM function uses a timer for two pins. There being a limited number of timers, there may not be one available to you.

Anything you can do with a timer, you can do without a timer, of the Arduino isn't overworked. If it is, having a timer interrupt it may not be a great idea.

Knowing what YOU want to do with a timer would be useful in order to suggest an approach.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 173
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It would appear so. You are able to edit the page, so why not correct it?

Onions.

I wanted verification first.

When I tried the Timer2 example on the web page, the compiler cannot find <MsTimer2.h>.
I've tries this with the timer2 library in the specified location, as well as under \Program Files\Arduino\libraries\
Logged

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

Is it safe to assume that you actually downloaded the MsTimer2 library?

If you did, did you restart the IDE after installing the library?
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17293
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?

I've used the MsTimer2 library for several of my projects, and I don't recall having any problems installing or using it. Here is where it is stored on my Windows XP system:

Quote

C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

17 Folders:

Bounce
Button
DS1307
EasyTransfer
Flash
FreqCount
FreqMeasure
MsTimer2
NewSoftSerial
Playtune
PS2Keyboard
SoftEasyTransfer
Streaming
String
Tone
WString
__MACOSX


0 Files:
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 173
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there an error on this web page http://www.arduino.cc/playground/Main/MsTimer2 regarding the Timer installation location?

I've used the MsTimer2 library for several of my projects, and I don't recall having any problems installing or using it. Here is where it is stored on my Windows XP system:

Quote

C:\Documents and Settings\Primary Windows User\My Documents\Arduino\libraries

17 Folders:

Bounce
Button
DS1307
EasyTransfer
Flash
FreqCount
FreqMeasure
MsTimer2
NewSoftSerial
Playtune
PS2Keyboard
SoftEasyTransfer
Streaming
String
Tone
WString
__MACOSX


0 Files:

How strange. This is not the default location- yet you don't seem to be having any problems using the IDE.
How did you get the IDE to find the libs there, instead of the default location?

I've just installed 0023 on Windows XP, and the default lib path is here (And is the same for 0022)
\Program Files\Arduino\libraries\

Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12631
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've noticed the library location being described differently in difrferent publications.

On my installation, done a couple of days ago (because I'm a noob), the standard libraries are all under C:\Program Files\(my installation directory)\libraries and that's where I've put the additional libraries I'm using; they all seem to work fine. My sketches were automatically saved under My Documents/Arduino but I don't have a library directory under there. Other people do seem to have libraries under there, though.

Is it possible the Arduino is clever enough to look in both locations?

Edited to add:

Yes, it is. I just created a library directory under My Documents/Arduino and put a new library in there, and it appears under Sketch->Import Library.
« Last Edit: November 16, 2011, 07:28:44 pm by PeterH » Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: