APP & Mobile Site

Here's some source code

I made a similar clock program for this module, no date though and a different setting method (button1: adjust forward, button 2: backward; getting faster after a few seconds.), plus some kind of seconds progress bar. Button3 sets brightness.

That requires some knowledge in and tools for micro-controller programming.You'd need a programmer for Atmel µCs (hardware, interface between PC and µC)and a cross compiler, in my case avr-gcc.(plus the programmer software like avrdude, probably included in one of the above).

I just learnt how to compile and flash AVR for this. I have always used arduino in the past, and its IDE takes care of all the compiling and flashing itself (and uses its bootloader over serial instead of ISP programming).

I just wanted to document how I flashed your program to help anyone else who is not sure how to do it.

Basically, first step is to get an ISP programmer.I got the "POLOLU USB AVR PROGRAMMER".

With the programmer unplugged from the computer, and the clock unplugged from external power, plug the programmer into the pins on the side of the clock.

Now, connect the external power to the clock. It should start up as normal, and show the clock on the screen. If its not showing, you plugged in the programmer in wrong and might be shorting something. Unplug it and check the pinouts more carefully.

Now connect the USB into the programmer. The programmer should now light up.

When you plug it into the computer, use "dmesg | tail" to find the name of the device that the programmer will show up on your machine as. For me it was "/dev/ttyAMC0".There was also AMC1, but that is the serial port on my programmer.

Now to verify that everything is connected and working properly, run avrdude.

avrdude -c avrisp2 -p m8 -P /dev/ttyACM0

-c is the programmer protocol you use for your programmer. Again, I am using the Pololu USB AVR Programmer, and it uses avrisp2.-p is the chip that you are programming. This clock has an MEGA 8 chip, its code in avrdude is "m8".-P is the port of your programmer on your computer. Again, for me this was ttyAMC0.

When you run this command it should just verify the chip and the connections.It should show something like this:

Now that you have a working programmer, we should back up the existing program on the clock.For this, we use the -U command.

avrdude -c avrisp2 -p m8 -P /dev/ttyACM0 -U flash:r:original.hex:i

its -U type:operation:filename:formattype: could be flash, eeprom, (h|l|e)fuse. We want to back up the flash.operation: r|w|v, read, write, verify. We want read to get the hex off the chip.filename: where we want to write it toformat: we want intel hex. So "i".

Now we need to compile the program from DrJones.

To do this, we will use avr-gcc and avr-objcopy.

avr-gcc -Os -std=c99 -mmcu=atmega8 -o clock.elf clockmtx.c

-Os: turn on optimisation, and target smallest file size.-std: the standard of the C code. In this case he is using c99 (for his for loops).-mmcu: the chip to compile for. gcc calls this chip "atmega8".-o: Tell GCC to link and write out to the file clock.elf.

Now, we need to make an intel hex file from this, using avr-objcopy.

avr-objcopy -O ihex clock.elf clock.hex

-O: tell it to write in intel hex format "ihex".

Finally, we want to flash it on the chip :)

avrdude -c avrisp2 -p m8 -P /dev/ttyACM0 -U flash:w:clock.hex:i

this time we tell it (with the -U command) to write with the "w" option the .hex file to the flash memory of the chip.

Now the clock should should be running the new program that DrJones has written :)

If you can order from the US, this $13 Arduino shield AVR ISP programmer from Evil Mad Science is great.http://evilmadscience.com/productsmenu/tinykitlist/253

Comes Arduino "shield" comes as a kit you solder together, and requires an Arduino to operate.

It can write Arduino bootloaders in the attached ZIFF socket or on target boards via the onboard ISP connector. It's not just for Arduino bootloaders, it works as an AVR ISP for programming raw AVR chips, and is supported by AVRDUDE.

My 104306 does nothing when I apply power. Am wondering if perhaps mine is DOA or if the Mega8 is simply blank. What's your experience of observed behavior of this device if powered on when the Mega8 AVR contains no code?

Should I expect a blink, flash, or any form of life when it's powered on with a blank AVR?

I will try Mic159's method of programming my Mega6 with your code, but am still curious if this bugger is DOA or simply has no brain!

Please note that DealExtreme Forums are not a sales or product support board. While we do constantly participate in this forum, please contact us via support ticket for a guaranteed fast response. We make every effort to make the quickest replies.

Partner with DX

Policy & Information

DX Everywhere

Follow Us

Note:Stock and Availability shown on this site is for your reference only. While
we strive to provide the most accurate and timely stock and availability information,
availability information may become out of date and may change between the time
you added an item to cart and the time your order is received.
Quantities on clearance items are limited. Prices are current at time of posting. DX Reserves the right to change prices at any time without notice.