How To Build a Flashlight With Perfect Modes (picture heavy)

It looks like AVR Studio doesn't define F_CPU, so the delay routines don't work. If your MCU is running at 1.2MHz, just add a "#define F_CPU 1200000UL" to the code, or "-DF_CPU=1200000UL" to the compiler flags. If your MCU is running at 4.8MHz, use 4800000UL instead.

Dear Tido,

Many thanks for your quick reply. The F_CPU was fixed. There is one more error need to be fixed. Thanks for your advise in advance.

You must have somehow removed or renamed the function start_wdt() or moved it below the point where it is called. I can't really say anything more specific without reviewing the whole source code.

This is your original driver.c just re-named BLF-LVD.c and amended line 1029 as per the Flashlight Wiki to support for C99.

All these screen shots have gotten me much closer to getting my dream light program working.Thanks guys for unwittingly helping me along with my project.

This is the absolute best thread ever read and I'm glad that it is in BLF and not in CPF. It really opens new perspectives, new "playgroung" for a rookie modder like me. I would have never imagine that it was possible.

Warm thank you to you Tido for your "sharing mind" ("sharing spirit", "sharing attitude" (don't know the appropriate translation for this))...and to all of you.

EDIT:

I finally received the USBasp key with 10 wires ribbon, the black SOIC8 clip without ribbon, the bleu Romonia SOIC8 clip with 8 wires ribbon.

I tried to attach the blue clip first but i had an error message: "error: could not find USB device "USBasp" with vid=0x16c0 pid=0x5dc" so I tried to find a driver for the USBasp key (I installed WINAVR before this step but it seems that it didn't install the required driver).

First I donwloaded this one: "vusb-20100715.zip" but the windows installer could not find the driver in the folder pointed in the README file.

Then I downloaded another one: "libusb-win32-bin-1.2.5.0.zip". I'm not a computer guru but the "inf-wizard.exe" that is in the "bin" folder installed it fine by double clicking the ".exe" and choose "USBasp" in the list.

I tested the connection as it is recommanded in the wiki but I got the error message described for a bad connection. As I read that the blue clip could make bad connection I switched to the black clip that worked immediately so I was able to backup files from a NANJG 105C, NANJG AK-47 and NANJG AK-47A.

I tried to read the files and codes that came with BLF-VFD but I'm lost. My bad english doesn't help.

I know that it is just a beginning and what I done is a piece of cake for most of you but I just would like to report to other newbies some details to solve some problems I encountered.

AVR Studio 4 has been my nightmare. I am in the same boat as you I can backup the files, but I am unable to write to the chips so hopefully someday I will figure it out.

Dear E1320,

Did AVR Studio 4 show any warning when you wrote your chip? What is the programer you are using? Studio 4 does not support USBasp programer.

I am using this USB isp programmer perhaps this is my problem?

It looks like you are not executing avrdude in the directory the target files are located in. Either cd into the directory holding the target files or give a full path on the command line.

Btw, before going to jump on the programming bandwagon i would like some answers from the masterminds behind this.

1. Are the KD 3x amc based drivers still working with this equipment?

2. Is it possible to program the chip to have lets say 1A high 500mA med and 50mA low AND have a beacon mode added 0,1Hz?

3. Is it possible to implement ramping with memory?

4. Can a potential beacon mode be hidden in the UI?

5. Can this be done also on the 8xamc based KD driver also?

Thanks. :)

Thanks Tido I changed the location of the target files now it only cannot find the .eep file

Probably yes. The last batch I ordered about three months ago was still equipped with ATtiny13s.

Yes. Well, not truly constant 50/500mA, but a PWM level that averages out to this values.

No. This would require one write cycle to the EEPROM for every light level passed during the ramping. Since the EEPROM ist rated for "only" 100,000 write cycles, this would probably wear it out in less than 1000 ramping operations.

Yes. Put it in the extended mode group, but not the main one.

If it is still based on the ATtiny13, yes.

You're welcome ;)

Have you moved both files (BLF-VLD.hex and BLF-VLD.eep)?

Tido, thank you very much. :)

It would be nice if someone makes a frontend for all that load of apps with dropboxes to quick select custom driver options and autocompile the choices in a flash ready format.

It can be done but someone must really sweat that one app. Willing to donate a few bucks for the martyr who would like to try such project and i bet i'm not the only one willing to contribute.

I really do not like the idea of learning some C++ or what is this based on (at least is not plain assembler).

Not me. I've even given up on keeping all possible driver configurations within a single source file. It's much easier and less error prone to just paste together a new driver from a library of standard functions and then add some glue code to make it all work together. At least if you know some basic C programming.

Sadly 0 programming experience. :/

Actually the only reason i don't have the hardware yet is i never fully understood the rewiring of the soic clip to the usb programmer interface as from what i gathered have to be fiddled with.

Anybody got any ideas?

Hi first post,

I have been following this thread with great interest (thank you Tido and everyone for the resource) and have purchased an avrispmkII and 3M soic clip. I am trying to reprogram a 2.8amp (8x 7135) driver that I purchased from Shiningbeam. I've hit a snag. Below is a screenshot of the error message I'm receiving. At first I thought the connection was bad but the green light comes on after I run the command, apparently indicating that the chip/target is receiving power. I've checked pinout three times, and I seem to have continuity in all pins. Any ideas from anyone? Is this the type of message I would get if the reprogramming fuse is set to prevent re-writing? Anything else I could check?

-Jon

Macintosh-3:~ JCI$ avrdude -P usb -p t13 -c avrispmkII -n

avrdude: stk500v2_command(): command failed

avrdude: stk500v2_command(): unknown status 0xc9

avrdude: stk500v2_program_enable(): cannot get connection status

avrdude: initialization failed, rc=-1

Double check connections and try again, or use -F to override

this check.

avrdude done. Thank you.

Looks like your connection isn't good, but I gave up a while ago I hit a dead end with my programming at this point. I actually de soldered a tiny13 chip to play around with so I can get the connections on easier. Sorry I couldn't be more help.