Teledyne-lecroy CATC Scripting Language Reference Manual Manuel d'utilisateur Page 51

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 57
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 50
C
HAPTER
12
Decoder Primitives
CATC Scripting Language
47
PeekNBits()
PeekNBits(<bit_count integer>)
Parameter Meaning Default Value Comments
bit_count integer
Return value
None.
Comments
Reads bit_count bits from the data source. The difference between
PeekNBits and NextNBits is that PeekNBits does not advance the global
bit offset. PeekNBits can be used to make decisions about how to parse the next
fields without affecting subsequent calls to NextNBits. If PeekNBits is called
without a prior call to GetNBits, the result is undefined. Note that bits are indexed
starting at bit 0.
Example
raw = 'F0F0';# 1111000011110000 binary
result1 = GetNBits ( raw, 2, 4 );
result2 = PeekNBits(5);
result3 = NextNBits(2);
Trace ( "result1 = ", result1, " result2 = ", result2,
" result3 = ", result3 );
This will generate this Trace output:
result1 = C result2 = 7 result3 = 0
In the call to GetNBits: starting at bit 2, reads 4 bits (1100), and returns the value
0xC.
In the call to PeekNBits: starting at bit 6, reads 5 bits (00111), and returns the
value 0x7.
In the call to NextNBits: starting at bit 6, reads 2 bits (00), and returns the value
0x0.
Pending()
Pending()
Parameter Meaning Default Value Comments
Vue de la page 50
1 2 ... 46 47 48 49 50 51 52 53 54 55 56 57

Commentaires sur ces manuels

Pas de commentaire