need help with programming

im new at programming microcontrollers and im trying to program an attiny13. i have the cradle and a USB Programmer but im really confused on how to add the code to the microcontroller. i tried to download a sample version here to test it out but i dont understand what im looking at (the code i want to test with is called test_leds.hex( this just makes the leds flash to test it) and its near the bottom under "pulling it together".

i downloaded the WinAVR program which i believe is used to right the code and im using the notepad it came with to right the code but i dont understand how to transfer that code to the microcontroller and i cant seem to make it into a hex file.

can anyone tell me what steps i need to take to program the attiny13? and how to use avrdude and to make hex files with winavr? i know its a lot to ask but i seriously want to learn how to do this.

sort by: active | newest | oldest
1-10 of 18Next »
gmoon8 years ago
Get avrdude to communicate and recognize the ATtiny13 (before you compile and upload a program.)

The ladyada link indicates that the programmer type is usbtiny. And the avrdude name for the AVR is t13. Try this (in a command prompt or shell window, ala DOS):
avrdude -c usbtiny -p t13
This link on ladyada's site has more detailed info. Look there for the possible responses you'll receive.

Once you get the computer--programmer--AVR link working, then move on to writing and compiling the code....
KT Gadget (author)  gmoon8 years ago
ok it detected both the programmer and the t13. do i need to turn the code into a hex file to be able to upload it to the t13 and if so how do i make the hex file? is winavr notepad able to turn it into a hex file cause when i tried it with one code but it didnt save as a hex.
gmoon KT Gadget8 years ago
Have you got AVRStudio installed? (download from Atmel.) You can create a project, import source files, configure for the target AVR, then "build."

Once you build, or compile the project, the hex files should be in the "default" directory, inside the project directory.

With the usbtiny programmer, you'll probably have to use avrdude directly, just like guyfrom7up.

Guyfrom7up, in fact, is probably the right person to help you....I've used AVRStudio a couple times, but generally I do everything in Linux. That involves editing source files in a text editor, then compiling the source with a Makefile in the shell, rather than doing it all within a development environment....
KT Gadget (author)  gmoon8 years ago
guyfrom7up said that you helped with his and he told me to ask you for help. you think you can with avrdude?
gmoon KT Gadget8 years ago
Sure, but it's kinda of a busy day. I'll get back to you this evening. Maybe someone else will help before then. Have you got a hex file built in AVRStudio?
gmoon gmoon8 years ago
Try this to program an ATtiny13 with your ISP hardware, and the hex file name of "myprog.hex":
avrdude -p t13 -c usbtiny -e -U flash:w:myprog.hex
The hex file would be in the current directory (obviously, change the file name to whatever's appropriate...)
also, I created a batch file where you don't' have to type in that code. ' I called it upload.bat so all you have to do in CMD is say: upload youprogram where yourprogram is you .hex file, except you don't need the .hex after that you just type in the AVR you are using. the only problem is the code only works for my programmer, but you might be able to do just a find and replace to make it work for yours. This is my first batch file (made a couple months ago), so it's probably poorly written (still works though!) and highly unorganized.
KT Gadget (author)  guyfrom7up8 years ago
ok it sees the attiny13 but after i enter it goes straight to the download without me having to choose what file i want to upload.
first off, did you edit the bat so it will work with your programmer (I don't know how easy this will be to do ???) the action (in the cmd window) upload blinky where blinky is just the name of your program. then you type in attiny13 I also made it so that a simple robot could program a bunch of AVRs simply by hitting the keyboard, so to exit the program you have to hit ctrl+c
KT Gadget (author)  gmoon8 years ago
k i tried this method but after it read the "on-chip flash data" it came with an error saying
"verification error, first mismatch at byte 0x0040
0xa0 != 0x0d
verification error; content mismatch"
this is the test led i was trying to load to see if my attiny was still working and thats when it came with the error. any idea whats going on?
1-10 of 18Next »