home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 33 / IOPROG_33.ISO / COMMON / LISTC.ZIP / kit.c next >
Encoding:
C/C++ Source or Header  |  1998-03-10  |  664 b   |  33 lines

  1. /* Programma per PIC 16c84 o 16f84
  2. ** LUCI SEQUENZIALI ALLA KIT
  3. */
  4.  
  5. #include <pic1684.h>
  6. #include "libxpic.c"
  7. #define NLED 8          /* numero di LED */
  8.  
  9. void main()
  10. {
  11.   int n;                /* variabile di ciclo */
  12.   int val;              /* valore del bit corrsipondente al LED acceso */
  13.  
  14.   inizializza();              
  15.   val=1;                       
  16.   while(1)                     
  17.   {                             
  18.     for(n=(NLED-1);n;n--)   /* sx */      
  19.     {
  20.       aspetta(1);
  21.       PORTB=val;
  22.       val<<=1;
  23.     }
  24.     for(n=(NLED-1);n;n--)   /* dx */
  25.     {
  26.       aspetta(1);
  27.       PORTB=val;
  28.       val>>=1;
  29.     }
  30.   }
  31. }
  32.  
  33.