attiny 85, any pointers?/

I just recentlygot a bunch of attiny85's and I was wondering how the best way to use them would be, I was thinking some wireless applications but those need spi or serial which it doesn't have I did a little research and it doesn't seem that bad to do the regular arduino code on it, but every other library looks like it needs to be reworked, does anyone know any good links to some attiny 85 libraries for like spi and serial?

The tiny85 does have a USI bus, I believe, which can be set-up as I2C and I believe SPI as well. And CB’s tiny core provides software serial compatibility

The 85's program memory isn't very big, lots (most?) libraries would gobble most of that up, leaving room for little else.

[quote author=Runaway Pancake link=topic=115822.msg871780#msg871780 date=1343220522] The 85's program memory isn't very big, lots (most?) libraries would gobble most of that up, leaving room for little else. [/quote]

The 85 has basically the same specs in terms of memory as the original Arduino with the ATMEGA8... 8k flash / 1k ram

That is a lot of space, more than my first desktop computer had...

Yes the USI can be used for SPI, but for that matter so can any 2-3 pins if you want to bit bang.

I've used 85s with AVR Studio, they are pretty easy to use even without the Arduino framework.


Rob

I was thinking along the lines of just transmitting simple enviroment data, other than the library not much code just digital or analog reads I was thinking using the nrf24l01 since they are so cheap but couldn't find any rx/tx examples with an attiny 85 anyone got a link to an attiny spi library? I could probably get the library that uses spi to work with another but the usi hardware to spi part I think is beyond my current level of programming Im gonna look into that cp's core since I definetly may have some hardwired rs485 uses for an attiny85

http://arduino.cc/playground/Code/USI-SPI

I did see that before but it didn't mention the 85, I guess that would work tho?

winner10920: I did see that before but it didn't mention the 85, I guess that would work tho?

The code might require some minor changes, but it should work.

winner10920: I did see that before but it didn't mention the 85, I guess that would work tho?

It doesn't mention the ATTiny except for this mention, you mean ;)

As you may know the ATtiny chips come with an USI module, which can be made to work as an SPI (master/slave) device, or even a I²C device as well. The latter is a bit tricky though for beginners. There's an article + library on the playground as well.

char *ptr = 0x0000014;

I've been waiting to see how long it took for someone to pick up on the "pointer" :)

But shouldn't it be

char *ATtiny = 85;


Rob

Lol good one, and I meant mention attiny 85 not the series in broad which I don't like to assume it works as is for everything since I imagine everything from the 28pin ic to the 6pin doesn't have the same machine code

28pin ic to the 6pin doesn't have the same machine code

By and large they are the same, different peripherals and numbers of peripherals of course and therefore different registers to address but the core machine instructions are the same (at the ASM source code level) and at the C level there's no difference.


Rob

So if I make a library called spi85 that basically includes that code, then change the mirf library to use the spi85 instead of regular spi, it should work right? I know size of the library may cause problems but I think I can handle that

There's always a gotcha but in theory it should work.

I don't know what the mirf library is or what it needs, but presumably you will have to emulate all the normal SPI functions with your own versions.


Rob

winner10920: Lol good one, and I meant mention attiny 85 not the series in broad which I don't like to assume it works as is for everything since I imagine everything from the 28pin ic to the 6pin doesn't have the same machine code

The actual machine code might be different but it isn't that likely since the AVR core was probably only implemented once. But you aren't talking machine code but a higher level abstraction in this case C/C++ (but it could even be assembly) and the same code could compile to different machine instructions. What might actually change between processors is the memory location of registers and such.

winner10920: So if I make a library called spi85 that basically includes that code, then change the mirf library to use the spi85 instead of regular spi, it should work right? I know size of the library may cause problems but I think I can handle that

As long as the library you create implements external methods needed by the mirf library and can handle the clock frequencies that the mirf library/chips need then it should work. I wouldn't focus on the example provided as a "go by", but rather use it in conjunction with the datasheets for the 85 (specifically the USI section) and the datasheets for the mirf chips when building your library.

Yeah I was thinking maybe instead of making spi work with the existing library it may be easier to entirely redo the existing library to better suit the attiny

Hi, Did you Try installing the hardware components for Arduino 1.0? I successfully got my ATTiny85 to collect data from a ping sensor mounted on a servo (that it too controlled) and send it to my PC using a pair of XBee wireless radios...Let me know if you have any questions...

Regards, Mr_E

Not yet, how did you add the attiny 85 to the core?

Moving back a few posts I had linked the Wire libraries tailored for the ATTiny85. Isn't that what you're looking for?