I am looking at programming some ATtiny85 micros using Arduino.
There seem to be two cores that I can use to supplement the Arduino package: Tiny Core and HLT.
What are the differences between the two and which one would you use?
I am looking at programming some ATtiny85 micros using Arduino.
There seem to be two cores that I can use to supplement the Arduino package: Tiny Core and HLT.
What are the differences between the two and which one would you use?
I use the Tiny Core from Coding Badly.
Mostly I use it because I have a direct path to support with it here on the forum, and because I ran into a couple features that HLT's didn't support (don't remember what, now).
HTL...
More stuff here...
Arduino Tiny uses Timer1 for millis?
For the ATtinyX5 family, yes. There is a compile-time switch in core_build_options.h to use timer0.
Why do you ask?
Just curious, good info to know. I could not be lazy and read the source code I suppose Anyway I've been fiddling with a t85 a bit lately. Started out with Arduino Tiny, then moved to WinAVR just for fun really; I only needed to implement millis (I used Timer 0), digitalRead, digitalWrite and pinMode for this particular project, all of which only took a few lines of code each. The program was smaller with WinAVR, but not by very much at all, so I was impressed! ... 1958 vs. 2048 bytes!
I could not be lazy and read the source code I suppose
Yes but there is a set of macros between wiring.c and the hardware that may make finding the answer a bit time consuming. In addition, the macros are split between two header files.
digitalRead, digitalWrite and pinMode for this particular project, all of which only took a few lines of code each
A tip-of-the-hat to Alessandro. His pin mapping makes those three functions a breeze to implement. I have a crude digital*Fast for the t85 that took just a few minutes to write and debug.
The program was smaller with WinAVR, but not by very much at all, so I was impressed! ... 1958 vs. 2048 bytes!
The next Tiny Core should do better; be closer to what you get with WinAVR. My plan is to introduce a variation of digital*Fast in the core with a compile-time option to disable it. The goal is not to make the code faster but smaller (a nice side-effect is that smaller generally is faster).
Heck that's so close it probably wouldn't have occurred to me that improvement was needed! Some overhead is expected in trade for the more general nature of Arduino Tiny.
1958 vs. 2048
Both of those fit on an ATtiny25 processor but the first leaves just enough empty space to add one more minor feature. I was faced with that exact dilemma with an ATtiny85 application. I could give up a minor feature or slap together a crude digital*Fast. I suspect other Tiny Core users have faced with the same dilemma.
The difference becomes more pronounced for smaller processors. For the ATtiny13, the lookup tables used in the digital functions consume 22% of Flash! Doesn't leave much room for the application.
Some overhead is expected in trade for the more general nature of Arduino Tiny.
Not necessarily. The Tone library makes a great example (Tone function is also a good example for the same reasons). The Tone library can generate one tone on any pin for each hardware timer using an interrupt service routine. It is very general purpose but also fairly large.
The Tiny Core is meant to fill a need for applications that don't need the processing power of ATmega328 (and family) or fill a need for a processor physically smaller than a ATmega328. In other words, applications that only need to generate one tone at a time on one pin. Need more tones? Need to use arbitrary pins? Use the ATmega328.
So, if we reduce Tone to its simplest form, we're left with one timer directly toggling one output pin. What is that to setup? About dozen machine instructions? Thanks some GCC compiler directives we can have our cake and eat it too. A simplified version (zero overhead) for constant parameters and a general purpose version for variable parameters.
Well again, it's pretty darned impressive if it can rival bare-bones no-frills down-and-dirty cowboy coding (how's that for a phrase!) Not real conversant with the compiler directives, but I was trying to duplicate an issue someone on the forum had and I had to go to great lengths to actually make it do what I wanted, it kept optimizing things out of the picture!
LOL, I thought of the ATtiny25 as well given that I somehow magically hit 2K exactly. I just got 10 ATtiny85s for $1.40 each from Mouser (making a little novelty item for Christmas presents XD). I'd have to be into some real volume to consider the t25. And check the t45, it's more than the t85! (but it has software BOD disable :().
ATtiny25V-10PU
1: $1.43
10: $1.33
25: $1.22
100: $1.14
ATtiny45V-10PU
1: $1.65
10: $1.41
25: $1.38
100: $1.32
ATtiny85V-10PU
1: $1.62
10: $1.40
25: $1.30
100: $1.29
Too much to retype. XD
I just got 10 ATtiny85s for $1.40 each from Mouser
That is exactly the same prices they were on 11/24/2010. Electronic parts: the only thing in the world that deflates in price.
(making a little novelty item for Christmas presents XD)
If you don't mind my asking, what are you making?
I'd have to be into some real volume to consider the t25.
That's why I go with the t85 or t84 instead of the smaller siblings or the t13. At the "volume" I buy, it just is not worth losing the memory.
And check the t45, it's more than the t85!
That's the way it was in November as well. I wonder why?
(but it has software BOD disable :().
At least it doesn't have something like the Pentium divide bug!
[quote author=Coding Badly link=topic=73270.msg552228#msg552228 date=1317026623]
I just got 10 ATtiny85s for $1.40 each from Mouser
That is exactly the same prices they were on 11/24/2010. Electronic parts: the only thing in the world that deflates in price.[/quote]
Seems sometimes semiconductors are cheaper than passive components. Recently got 2N3904s for $0.02 each, down in the resistor price range!
(making a little novelty item for Christmas presents XD)
If you don't mind my asking, what are you making?
Actually an idea I got from the forum here. Technically unimpressive, basically just blinking some LEDs. I may post it once the PC boards come XD
And check the t45, it's more than the t85!
That's the way it was in November as well. I wonder why?
The only thing I could think is volume, maybe they sell more t25s and t85s? I also have to wonder why they even make the smaller versions.