LED光立方制作全过程(二十九)
0赞Step 47Test the cube

The test code you programmed in the previous step will let you confirm that everything is wired up correctly.
It will start by drawing a plane along one axis, then moving it along all 8 positions of that axis. (by plane we mean a flat surface, not an airplane :p) The test code will traverse a plane through all three axis.
After that, it will light the LEDs in a layer one by one, starting at the bottom layer.
If any of the layers or columns seem to light up in the wrong order, you have probably soldered the wrong wire to the wrong layer or column. We had one mistake in our cube ;)
If you find anything that is out of order, just de-solder the wires and solder them back in the right order. You could of course make a workaround in software, but that would eat CPU cycles every time the interrupt routine runs.
You can compare your cube to the test video below:(。。。。)
Step 48Program the AVR with real code





So everything checked out in the test. It's time to program the ATmega with the real firmware!
For the most part, the process is the same as in the previous programming step. But in addition you have to program the EEPROM memory. The LED cube has a basic bitmap font stored in EEPROM, along with some other data.
Firmware is programmed using the same procedure as with the test code.
Firmware:
- avrdude -c usbtiny -p m32 -B 1 -U flash:w:main.hex
EEPROM:
- avrdude -c usbtiny -p m32 -B 1 -U eeprom:w:main.eep
-U eeprom:w:main.eep specifies that we are accessing EEPROM memory, in write mode. Avr-gcc puts all the EEPROM data in main.eep.
If you don't want to play around with the code, your LED cube is finished at this point. But we recommend that you spend some time on the software side of things as well. That's at least as much fun as the hardware!
If you download the binary files, you have to change the filenames in the commands to the name of the files you downloaded. If you compile from source the name is main.hex and main.eep.
