This is an old revision of the document!
This page describes how to add the AVR Dragon as programmer to the Arduino IDE, compile for ATtiny13 and program as such the ATtiny13 directly from within the Arduino IDE.
As described here, copy paste the following url
https://mcudude.github.io/MicroCore/package_MCUdude_MicroCore_index.json
Into Arduino IDE at: File → Preferences → Additional Boards Manager URLs:
Then click on OK.
Then select the newly added Board via: Tools → Board → Boards Manager…
Search for MicroCore and click on Install.
Now a new entry will be listed at: Tools → Board → MicroCore → ATtiny13
Select this controller.
To make it possible to program directly with the AVR Dragon from within the Arduino IDE the ATtiny13, search for the following file:
$HOME/.arduino15/packages/MicroCore/hardware/avr/1.0.6/programmers.txt
And add the following lines at the bottom:
dragonisp.name=Dragon ISP dragonisp.communication=usb dragonisp.protocol=dragon_isp dragonisp.program.protocol=dragon_isp dragonisp.program.tool=avrdude dragonisp.program.extra_params= -p attiny13 -c dragon_isp -P usb
Now the AVR Dragon can be selected via: Tools → Programmer → Dragon ISP
Follow the link to the connection diagram at the official github page getting-started-with-microcore will show how to connect the ATtiny13 to the AVR Dragon.
Start with burning the bootloader from within arduino. (Tools → Burn Bootloader)
Then add following blink code:
void setup() { // initialize pin 4 (ATtiny leg 3) as an output. pinMode(4, OUTPUT); } void loop() { digitalWrite(4, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(4, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
And compile, program and observe that pin 3 alternates between 0v and 5v in a 1s interval
/* * Output test */ /* * pinout: * https://camo.githubusercontent.com/b621cdf0625c6a9e961bb3ac5c94c46198f7585d/687474703a2f2f692e696d6775722e636f6d2f4a7362677550562e6a7067 */ #define P1_PB5 5 #define P2_PB3 3 #define P3_PB4 4 #define P5_PB0 0 #define P6_PB1 1 #define P7_PB2 2 // the setup function runs once when you press reset or power the board void setup() { pinMode(P2_PB3, OUTPUT); pinMode(P5_PB0, OUTPUT); pinMode(P6_PB1, OUTPUT); pinMode(P7_PB2, OUTPUT); } // the loop function runs over and over again forever void loop() { for (int i=0; i <= 255; i++) { digitalWrite(P2_PB3, (i & 1) != 0); digitalWrite(P5_PB0, (i & 2) != 0); digitalWrite(P6_PB1, (i & 4) != 0); digitalWrite(P7_PB2, (i & 8) != 0); delay(500); } }
Now you can easy verify if all pins are correctly controlled: Pin 2 should show every 0.5 second a change, Pin 5 should show every second, pint 6 every 2 seconds and pin 7 every 4 seconds.