#include <io8515v.h>
#include <macros.h>
/* This seems to produce the right amount of delay for the LED to be
* seen
*/
void Delay()
{
unsigned char a, b;
for (a = 1; a; a+=2)
for (b = 1; b; b+=2)
;
}
void LED_On(int i)
{
PORTB = ~BIT(i); /* low output to turn LED on */
Delay();
}
void main()
{
int i;
DDRB = 0xFF; /* output */
PORTB = 0xFF; /* all off */
while (1)
{
/* forward march */
for (i = 0; i < 8; i++)
LED_On(i);
/* backward march */
for (i = 8; i > 0; i--)
LED_On(i);
/* skip */
for (i = 0; i < 8; i += 2)
LED_On(i);
for (i = 7; i > 0; i -= 2)
LED_On(i);
}
}