As I am an old programmer I suddenly got into the urge to start back programming again. Being it's now 2018 for me it was hard to figure out the ins and outs of the usbasp and junk. back in my day I used an old parallel port programmer and IC-PROG.
I looked all over the internet for a quick Flash on off I could just use to ensure I had my hardware configured correctly. However, I was unable to find a usable flash file for the attiny2313. This created even more problems for me since all I wanted was a working flash so I could troubleshoot my programmer etc,,. I eventually made my way back to where I once was after several post here, and several stressful days of failure.
I am using a very basic usbasp atmega8 programmer that plugs into your usb port. I quickly learned to use a program called (zadig 2.3) build 701 on a windows 7 computer. I wasn't sure how to use the program for a few days due to the stress and aggravation of drivers and other programmers that was distracting me, I was under allot of stress. So this information is not for the educated but for the next new-comer that's seeking to do exactly what I was.
So Open Zadig and select (options) tab and select List all devices. Then in the top dropdown box you should see your programmer, dont worry if you dont know what your looking for because you can actually unplug your USbasp and re-plug it back in and you will be able to see your device as it pops up in the drop down menu and dissapear again when its unplugged.
once you've located your device, select the libusb driver and click replace driver.
you can click your start menu on your windows 7 or so machine and right click on (my computer) and you should then see a manage option to click on. When the dialogue box appears double click device manager. your device should be under (libusb-win32 devices) - and it should say USBasp. if so, your good.
Now, enter your flash code into your selection of AvrStudio. I used Avrstudio 5 because at that time I found it easier to locate the hex file I needed. Enter this code.
.include "2313def.inc" .def delay1 = r17 .def delay2 = r18 .def delayv = r19 rjmp main delay: ldi delay1,0xFF ;was clr ldi delay2,0xFF ;was clr ldi delayv, 0x20 ;Build this, locate the .hex in mydocuments delay_loop: ;find the avrstudio folder, then your project name folder- ;you created dec delay2 ;thats where you'll find your hex file in the debug folder. brne delay_loop ;click build top left of avrstudio. dec delay1 brne delay_loop dec delayv brne delay_loop ret ; go back to where we came from main: sbi DDRD,4;, led ; connect PORTD pin 4 to LED sbi DDRD,2;, led ; connect PORTD pin 4 to LED sbi DDRD,3; TURN OFF LED P B 3 sbi DDRD,1; TURN OFF LED P B 3 loop: sbi PORTD,4;, led ; turn PD4 high sbi PORTD,2;, led ; turn PD4 high cbi PORTD,3; TURN OFF LED P B 3 cbi PORTD,1; TURN OFF LED P B 3 rcall delay ; delay for an short bit cbi PORTD,4;, led ; turn PD4 low cbi PORTD,2;, led ; turn PD4 low sbi PORTD,3; TURN ON LED P B 3 sbi PORTD,1; TURN ON LED P B 3 rcall delay ; delay again for a short bit rjmp loop ; recurse back to the head of loop
Locate and download eXtreme Burner - AVR v1.4.3
open your built hex file as instructed in the assmebly code comments, and flash your attiny2313. PortD pin, 4,3,2,1 is ready to accept the negative terminal of your led light. 1 out of 4 of my attinys were bad, so that is further stressing which is another reason I am writting this tutorial.
I used a 3.5 volt battery pack to power my target chip, the attiny2313, and the negative terminal on the USbasp Header must also be connected to the negative terminal of the atmel. If you've done all this and you still have errors, you probrably got a faulty attiny. If you have any problems, or need any help, Feel free to send me a message. This took me days and hours invested to figure out. All-though it may seem simple to most, to guys like me, well, we get lost. I hope I have helped someone out there seeking this information.
* Brian, you in part named the post "Tutorial", so I have moved it to the Tutorial forum. Moderator. *