Monday, January 11, 2010

AVRs

I finally got to turn leds ON and OFF. In fact, I have made them light on based on a pattern :

PORTD = 1;
Delay( );
PORTD=2;
/*etc ...*/

I actually used the code that is recommended by AVR gurus that is using C operators, however for this simple purpose, I just ommit them here.

My delay routine was simple:

void Delay( void )
{
      int cnt = 5555; /*Should be unsigned long cnt = 5555 */
      while( cnt-- );
}

Dumb me. The compiler will ignore my int cnt ! I just need a unsigned long int  and it will work. Well, it has worked ! :-)

Yikes.

No comments: