daily pastebin goal
11%
SHARE
TWEET

Untitled

a guest May 16th, 2018 107 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include    <htc.h>
  2. #include    "serial.h"
  3. #include    "delay.h"
  4.  
  5. __CONFIG ( FOSC_HS & LVP_OFF & CP_OFF & WDTE_OFF ); // HS osc
  6.  
  7.  
  8. #define R 0x04 // RB2
  9. #define G 0x10 // RB4
  10. #define B 0x02 // RB1
  11.  
  12.  
  13. void main(void)
  14. {
  15.     OSCCON = 0b01110000; // 8Mhz modus
  16.     CM1CON0 = 0b00000000;
  17.     CM2CON0 = 0b00000000;
  18.     ADCON0 = 0b00000000;
  19.     TRISB = 0b00000000;
  20.     PORTB = 0x00;
  21.     ANSELH = 0b00000000; //Clear analog bits to digital
  22.     ANSEL = 0b00000000;
  23.     PIE1 = 0b00000010; // Timer2 PR2 match on
  24.     PIE2 = 0b00000000; // safety
  25.     PIR1 = 0b00000000;
  26.     PIR2 = 0b00000000;
  27.     INTCON = 0b11000000; // GIE on, PEIE on
  28.     T2CON = 0b01001101; // POST: 1:10, timer2 on, PRE: 1:4
  29.     serial_setup();
  30.    
  31.    
  32.     while(1)
  33.     {          
  34.         PORTB ^= R + G + B;
  35.         DelayS(1);
  36.     }
  37.    
  38.  
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top