ATmega128A AVR
From early experiments blinking LEDs with an Arduino I started thinking about minimalist ATmega328 based projects (more on that later), then swapping out larger AVR chips for smaller versions - firstly using the amazing Attiny85 and eventually the small but surprisingly useful Attiny13a.But along the way I wondered what, if any, advantages lay with some of the larger AVR chips available. Late one night (and isn't that always the way) I spotted the ATmega128A on AliExpress, and foolishly went ahead and ordered a few based on the promises of the extensive datasheet.
Impressive Specs |
Now that looks pintastic! |
So back to AliExpress for some SMD to DIP boards and a USBASP programmer, and then I had to build a specialist programming adapter for the USBASP to connect. Yeah, this was working out real well at this point, good decision!?
First we need to make connect to a DIP-ish style compatible adapter |
Lovely soldering, but a bit scary |
Dodgy looking (but functional) homemade programming shield |
Mmmm, probs need to clean that mess up at some stage |
The Atmega128 mounted on the adapter and then into the programming shield |
A couple of more hurdles remained. Firstly the Arduino IDE needed suitable board functionality to match the chip, and that came from the amazing MCUdude, with one wrinkle being that the upload had to be via the "upload using programmer" option on the sketch menu (hours of fun assuming the connection was faulty before I spotted that one).
Finally I needed to work out how to address the chip using the correct pins - which was a bit of a head scratch until I worked out that in order to use the FADE sketch I should address only those pins marked PWM on the pinout (in my case PE3 or pin 5 on the chip or the third pin on the pinout).
Finally I needed to work out how to address the chip using the correct pins - which was a bit of a head scratch until I worked out that in order to use the FADE sketch I should address only those pins marked PWM on the pinout (in my case PE3 or pin 5 on the chip or the third pin on the pinout).
/* Fade This example shows how to fade an LED on pin 9 using the analogWrite() function. The analogWrite() function uses PWM, so if you want to change the pin you're using, be sure to use another PWM capable pin. On most Arduino, the PWM pins are identified with a "~" sign, like ~3, ~5, ~6, ~9, ~10 and ~11. This example code is in the public domain. http://www.arduino.cc/en/Tutorial/Fade */ int led = PE3; // the PWM pin the LED is attached to int brightness = 0; // how bright the LED is int fadeAmount = 5; // how many points to fade the LED by // the setup routine runs once when you press reset: void setup() { // declare pin 9 to be an output: pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // set the brightness of pin 9: analogWrite(led, brightness); // change the brightness for next time through the loop: brightness = brightness + fadeAmount; // reverse the direction of the fading at the ends of the fade: if (brightness <= 0 || brightness >= 255) { fadeAmount = -fadeAmount; } // wait for 30 milliseconds to see the dimming effect delay(30); }
The overhead
Arduino Nano: Sketch uses 1144 bytes (3%) of program storage space. Maximum is 30720 bytes.
ATmega128A: Sketch uses 1530 bytes (1%) of program storage space. Maximum is 130048 bytes.
Arduino Nano: Sketch uses 1144 bytes (3%) of program storage space. Maximum is 30720 bytes.
ATmega128A: Sketch uses 1530 bytes (1%) of program storage space. Maximum is 130048 bytes.
Which is all fine, but *WOW* that took a bit more mucking around than expected for the result. Fun? Of course! And now if I ever need a huge AVR with 53 GPIOs (!!) then I'm all good.
can you show the circuit diagram between usbasp and Atmega128?
ReplyDeleteThis comment has been removed by the author.
ReplyDelete