Advertisement
Guest User

Untitled

a guest
May 31st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <p18cxxx.h>
  2. //#include "init.c"
  3. //#include "init.h"
  4. //void startop()
  5. #define led1    PORTBbits.RB0
  6. #define led2    PORTBbits.RB1
  7. #define led3    PORTBbits.RB2
  8. //#define led4  PORTBbits.RB3
  9. //#define led5  PORTBbits.RB4
  10. //#define led6  PORTBbits.RB5
  11.  
  12. //#define onemilli Delay1KTCYx(12) //DELAY 1 mil sek
  13. #define milli50 Delay10KTCYx(60) //Delay 50mil sek
  14.  
  15. /*delay på 1 sek*/
  16.  
  17. void sekunder() //delay på 1 sek
  18. {
  19. int  i;
  20.  for(i=0;i<20;i++)
  21.     {
  22.     milli50; // delay10tcy(60)
  23.     }
  24. }
  25.  
  26. void main()
  27. {
  28.     TRISBbits.TRISB0 = 0;
  29.     TRISBbits.TRISB1 = 0;
  30.     TRISBbits.TRISB2 = 0;
  31.     TRISBbits.TRISB3 = 0;
  32.     TRISBbits.TRISB4 = 0;
  33.     TRISBbits.TRISB5 = 0;
  34.  
  35.  /* Reset the LEDs */
  36.     PORTBbits.RB0 = 1;
  37.     PORTBbits.RB1 = 1;
  38.     PORTBbits.RB2 = 1;
  39.     PORTBbits.RB3 = 1;
  40.     PORTBbits.RB4 = 1;
  41.     PORTBbits.RB5 = 1;
  42.  
  43.  
  44.  //startop(); // Init
  45. led1 = 0;    // led 1 lyser
  46. sekunder(); //tæller 1 sek
  47. led2 = 0;
  48. sekunder();
  49. led3 = 0;
  50.  
  51.  
  52. do{
  53.         } while(1);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement