SHARE
TWEET

Untitled

a guest Jun 16th, 2019 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <xc.h>
  2. #include <stdint.h>         /* For uint8_t definition */
  3. #include <stdbool.h>        /* For true/false definition */
  4. #include "configs.c"
  5.  
  6. void main(void) {
  7.  
  8. InitProgram();   // THIS SETS UP THE TRIS AND SETS THE C PORT TO OUTPUT
  9.  
  10. //  DECLARE AND SET VARIABLES
  11.  
  12. int x;             //  GENERAL PURPOSE VARIABLE TO USE ON THE FLY
  13.  
  14. LATC = 0b00111111;
  15.  
  16. while(1)
  17. {
  18.     x = rand() % 6;   //  SHOULD GENERATE 0 THROUGH 5 B/C NO "+ 1"
  19.  
  20.     LATC = LATC ^ 1 << x;
  21.  
  22.     //  I HAVE ALSO TRIED LATC = LATC ^ 1 << (char) x;
  23.  
  24.     //  THERE IS A ONE SECOND DELAY HERE
  25.  
  26.  }
  27. }
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