howto: Use Atmel AVR Studio 5 to make a .hex file

I can always get Comfy to knock it down to size and email me the hex file. :slight_smile: Then I could hook up my big jumper cables to it and wait for lightning….“It’s ALIVE!”

For a simple one like minimo all you have to change is the PWM levels. '0' is off, '255' is 100%.

So take the line in the original that says:

uint8_t modes[]={0, 8,90,255}; //PWM values, 5..255 - LEAVE THE "0" THERE

and change it to:

uint8_t modes[]={0,3,9,28,85,255}; //PWM values, 5..255 - LEAVE THE "0" THERE

(or, if you'd like to try it with the levels descending instead of ascending, do:

uint8_t modes[]={0,255,85,28,9,3}; //PWM values, 5..255 - LEAVE THE "0" THERE

and each short press will decrease one level instead of increase.)

(PWM values under 5 only work with the FETs, 7135s will sometimes work at 4 but not always reliably; stick to 5 as the lower bound for a 7135 driver)

luxdrv 0.30b works just the same, though the code is much more complex. You can edit the number of levels and their PWM values just the same. It gets more complicated if you want to do stuff like delete the ramping or strobe modes, you just have to comment out (add a '//' at the beginning of the line) the obvious stuff, then see if it builds without errors. It will tell you if anything is left behind that was tied to the part you commented out.

The software you'll need, at least to see the same things I see on my screen (that helps when following a step-by-step), is:

WinAVR: http://sourceforge.net/projects/winavr/ (install guide)

libusb-win32 for the driver for the USBASP programmer: http://sourceforge.net/projects/libusb-win32/

and AVR Studio 5.1.208. (try this: https://docs.google.com/file/d/0Bz85IxvlZQErdlpFYUhpbjYtZGM/edit - if you can get it to download, it should be the non-broken version of the installer, it's the right filesize)

This is a huge help. Parts are on order. Hope to begin in about 2 weeks from now.

Comfy, the step by step screenshots are a fantastic idea! Handholding, as it were. Thanks, this just might get me through it…

I plan to install AS5 today and wade in, look around, see if I can figure it out. With some luck, I’ll also attack the clip today and get the wires in the correct places for the ATiny13.

USB Programmer hasn’t shown up yet, but I’ve ordered components for the new FET board and eagerly await the direction to order the boards themselves.

Thanks again for leading me off into parts unknown…

The pics don’t seem to be working. Would anybody mind uploading the screenshots to an image hosting service?

When I followed the screenshots everything in mine went right along with the tutorial, up until the time to expand the Output file. There’s not a hex file there, only the .c file. So what am I doing wrong?

You need to copy the .hex file into the same directory you run the.bat file

and you need to make sure the .bat file has the exact name of the.hex file it is going to load to the ATtiny in it or it will fail

Ok, but if I am changing something in the original file, say 30 second Turbo Timer from 60 second, and I want to creat a new .hex file, I went through the steps just like Comfy shows and when I build it it comes through error free but there is no .hex file in the output file in the upper right hand corner to save anywhere.

If your build was successful, there should be a hex file in your project directory. (my documents\Atmel Studio\project name\project name\debug\
Can you please look if there are any files in that directory?

There are files in there, GCC files, C files, and more, but no .hex.

Try this:
when you have code ready -> Ctrl+F7 and then if no errors -> F7

I have no idea what expanding the output file is, but the hex file will be together with about 8 other files in your project's DEBUG folder.

^^^ That step.

When you double-click the 'Output Files' header, what's in the list? They're hidden when that item is collapsed.

And which exact version of AVR Studio are you using?

I copied the C file that I have and applied it to a new project, project number 5. I ran it, it completed, and again there is nothing except the .c file in the output area. The output area cannot be expanded, having only that one file under it.

However, this time, in the Documents folder under ACCG5 in the debug folder there ARE multiple files, including the .hex file. :slight_smile:

Now I need to figure out how to flash that to the mcu… baby steps for small minded people (or drain bamaged people, your choice)

Finally found the SCK wire from my clip was not making contact in the block, now that it’s working I’m thinking about soldering all the little blades to the wires. That was far more aggravating than should have been possible…

Double-click the line that says 'Output Files', or click the little white arrow next to it. By default it is collapsed and you cannot see the list of files as it looks in my screen cap.

Clicking the white arrow turns it black and opens the list of files. Like, DUH! Thanks Comfy.
My knuckles are sore from dragging the ground…

When I arrive at this step “Build > Build AVRGCCxx” I am getting this:

I am trying to make a .hex file for MiniMo

I thought the original code was omitted to declare lastmode. Add lastmode=1, to the 10th line uint8_t count=0,mode=0,waspressed=0;

Stock code minimo?

I compiled the original code
https://www.dropbox.com/sh/e9n69yjcmj1s24m/AAAzVZaYmnfLUTghN-Cz9b74a

@Microa
Thanks!

@WarHawk-AVG
Yes the stock one.
I will try it tomorrow, now I am using “STAR momentary with srobo…” and it works nice.
I wanted to modify MiniMo to get short press for “ON/OFF” and long press to be for “next mode”, and to have memory. That would be perfect for momentary switch.
It is very annoying when you don’t have single click for ON/OFF

P.S. MiniMo doesn’t have voltage monitoring and strobe :frowning: