Step 5: Programming and Simple Test Program
IMPORTANT! We have to disable JTAG from PORTC, if we don't do that, the lcd-module won't work, so it is necessary.
In Linux operating we can do it with avrdude command:
avrdude -p m16 -c stk200 -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m
This command disables JTAG and set 8Mhz internal oscillator up and use. Our board have external crystal, but people use different size of crystals, so this command is safe for all. If you wanna use your external crystal here is sitefor calculating correct fuses.
IMPORTATNT! Be careful with fuse programming. If you set wrong fuse values, your processor will be inoperative. There is a way recover it with external pulse, but let's hope that you don't have to do that =)
Simple testing program:
DDRA = 0xff; // set port as output
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
PORTA = 0x00; // disable all pull-ups
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x00;
It is time to power up the board and send this little test program to processor with the winavr or what ever you wanna use.
Now we can test that our ports works correctly. Put one end from the wire to the one of the leds pinhead and touch with the another end every ports spike step by step. The led should shine every time. If it not shine, then there is something wrong with the soldering. Remember test also that every led works.