LED_90.C  


Simple outputs to drive 8 LEDs

///////////////////////////////////////////////////////////////////////////
////                                                                   ////
////                       LED_90_C.C                                  ////
////                                                                   ////
////   Program demonstrate how to output and turn on & off the LEDs.   ////
////   The program blinks the series of LEDs from LED1 to LED8         ////
////   turning on & off one after another sequentially. When it        ////
////   reaches LED8, it repeats the process all over again starting    ////
////   at LED1. ( Micro = AVR AT90S2313 )                              ////
////	                                                                 ////
////        (C) Copyright 2000 Blitzlogic Sdn Bhd                      ////
////        	                                                     ////
///////////////////////////////////////////////////////////////////////////

#include < io2313.h >
#include < macros.h >

char const num[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
 
void wait( ){	;    }


void main()
{
  unsigned int i;   /* Delay var */
  unsigned char j;  /* LED var */

  while (1) { /* Loop forever */

    for (j=0; j< 8; j++)  {   /* Blink LED 0,1,2,3,4,5,6,7 */
      PORTB = num[j];                       /* Output to LED Port */
     
     for (i = 0; i < 10000; i++) /* Delay for 1000 Counts */
        {  
          wait ();                      /* call wait function */
          }
      }
   }
}


Navigation Bar
tech_support@blitzlogic.com