daily pastebin goal
67%
SHARE
TWEET

Untitled

a guest Jan 26th, 2012 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. component gearshift16 "8bitconv";
  2. // This takes an 8 bit number 0-255 and converts it to bits 0-7
  3.  
  4. pin in unsigned in "0-255 number in";
  5.  
  6. pin out bit bit0out "first bit";
  7. pin out bit bit1out "second bit";
  8. pin out bit bit2out "thrid bit";
  9. pin out bit bit3out "fourth bit";
  10. pin out bit bit4out "fifth bit";
  11. pin out bit bit5out "sixth bit";
  12. pin out bit bit6out "seventh bit";
  13. pin out bit bit7out "eigth bit";
  14.  
  15.  
  16. function _ ;
  17. license "GPL";
  18. ;;
  19.  
  20. #include <rtapi_math.h>
  21.  
  22.  
  23.  
  24. FUNCTION(_) {
  25.  
  26.         bit0out=in & 1 ;
  27.         bit1out=in & 2 ;
  28.         bit2out=in & 4 ;
  29.         bit3out=in & 8 ;
  30.         bit4out=in & 16 ;
  31.         bit5out=in & 32 ;
  32.         bit6out=in & 64 ;
  33.         bit7out=in & 128 ;
  34.                        
  35.  
  36.  
  37. }
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