Ads

Tuesday, October 28, 2008

Easier than I thought...

So I had a free 15 minutes today and the result:



I implemented the four LED counter that I was talking about last time. One of the pins that I used is also used to program the device, so I have to move the reset and that pin (17/PB3/MOSI).

code:
#include < avr/io.h >
#include < util/delay.h >

#define nop() __asm__ __volatile__ ("nop")
//My chip is 20 Mhz
#define F_CPU 20000000UL

int main(void)
{
DDRB = 0xFF;
PORTB = 0x0;
while(1)
{
PORTB += 1;
_delay_ms(1000.0);

if(PORTB == 16) {PORTB = 0;}
}
return 0;
}

//endcode
So, I just realized that my header info last time probably didn't work, as I used < and > .

Next step, do the same thing with the shift register chip in there.
After that, figure out timers/interrupts.

No comments: