TV-B-Gone with ATmega16L
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

TV-B-Gone with ATmega16L

by kscharf on Sun Dec 30, 2012 12:46 pm

The attiny85 is well suited for the job, so why use an ATmega16L? Because I HAD some in the junk box (and they can store twice as many codes!)
Of course it isn't as simple as recompiling the code with MCU changed to atmega16 in the Makefile. Atmel moved the various timer control bits around and renamed registers between the two parts. However comparing the data sheets of the two parts showed that the job would be simple. I've posted the changes I made to main.c and main.h. Now just change the line containing "MCU = " in the Makefile and you're good. The IRLED moves to PB3 on the atmega16 since that's where the output compare bit in the timer hooks to. Otherwise the pin functions are the same (but on different pin numbers!). You could easily make the same sort of changes to use an atmega328 so that an Arduino could run the code (but you'd have to overwrite the bootloader).

Second thoughts:
The atmega16L is a 40 pin chip (available in smaller 44 pin TQFP packages) and has more than 8 times as many IO pins as the attiny85. It also has a hardware uart, so if you want to enable the debug code you should rewrite the serial output routines to use the actual uart. I will look at that later. The atmega168 family would make more sense as a substitute than the atmega16 / atmega164 family since the 40pin part is overkill. Again I used this part because I had one. I'm posting this to show how you can port a design so you can use a part you happen to have rather than buy one that you don't.

BTW, I haven't yet actually tried this but I have the breadboard wired up and will do so later today. I see no reason it won't work (baring a typo in my code) based on my experience working with the AVR family for the past few years. I'll report back later. Have fun!
change cpu type
(1.19 KiB) Downloaded 133 times
Mods to main.c to use atmega16l
(16.39 KiB) Downloaded 138 times

Posts: 209
Joined: Wed Sep 10, 2008 10:29 am

Please be positive and constructive with your questions and comments.