Go Down

Topic: difference in programming of attiny and atmega. (Read 164 times) previous topic - next topic

goyaam

hello forum,
I am new to programming in AVR, i saw different chips of atmega and attiny working on ISP technology, I want to know that if I create a hex file for any atmega ic, will it also work on attiny ic ? ( i will be changing the port names according to configuration for atmega and attiny)
Regards
Goyaam

septillion

if I create a hex file for any atmega ic, will it also work on attiny ic ?
No, the hex is device specific (so isn't only a problem between ATmega and ATtiny but all). Exception is with some types which only differ in memory size.

i will be changing the port names according to configuration for atmega and attiny)
How are you planning to do that in a hex?

If you mean, can I use the same C/C++ code on a ATmega or ATtiny than it's a different story. As long as your program doesn't use (non standard) hardware specific peripherals you can use the same code (with changed pins) as long as you also gave the IDE support for the ATtiny you use. But the key here is hardware specific peripherals. For example, the normal Servo library does not work on a ATTiny because it's lacking a 16-bit timer1.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

DrAzzy

For example, the normal Servo library does not work on a ATTiny because it's lacking a 16-bit timer1.
Only attiny x5, x61. The other attinys have a 16bit timer1
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

septillion

Alright, I meant ATtiny85*. But my point is the same, hardware specific code (aka code that does direct register manipulation) might not be portable.

* On those other ATTiny's, are the Timer 1 registers the same?
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

Go Up