Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- component bitconv "bitconv";
- // This takes an 8 bit number 0-255 and converts it to bits 0-7
- pin in unsigned in "0-255 number in";
- pin out bit bit0out "first bit";
- pin out bit bit1out "second bit";
- pin out bit bit2out "thrid bit";
- pin out bit bit3out "fourth bit";
- pin out bit bit4out "fifth bit";
- pin out bit bit5out "sixth bit";
- pin out bit bit6out "seventh bit";
- pin out bit bit7out "eigth bit";
- function _ ;
- license "GPL";
- ;;
- #include <rtapi_math.h>
- FUNCTION(_) {
- bit0out=in & 1 ;
- bit1out=in & 2 ;
- bit2out=in & 4 ;
- bit3out=in & 8 ;
- bit4out=in & 16 ;
- bit5out=in & 32 ;
- bit6out=in & 64 ;
- bit7out=in & 128 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement