ReadBits
Result = ReadBits(SrcValue, Startbit, BitCount)
 
Parameters:

    SrcValue = The source value to read bits from
    Startbit = Bit from where to start
    BitCount = Number of bits to read
Returns:

    Result
 

      The ReadBits returns a range of bits defined by StartBit and BitCount from SrcValue.





Mini Tutorial:


      Showing the use of the function ReadBit

  
; assign values to variable SrcValue
  SrcValue=$AABBCCDD
  
; Return 8 bits starting at bit 16
  Print Hex$(ReadBits(SrcValue, 16,8))
  
; Return 16 bits starting at bit 32
  Print Hex$(ReadBits(SrcValue, 32,16))
  
  
; Display the output and wait for key.
  Sync
  WaitKey
  



This example would output.

  
  $CC
  $AABB
  

 
Related Info: And | CopyBits | Move8 | Or | Xor :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com