Guest User

Untitled

a guest
Nov 17th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. uint16_t shiftRegister(){
  2. static uint16_t LFSR = 44257; // Start value
  3. int bit = 0;
  4. int mask = ((sizeof(uint16_t) * BITSPERBYTE) - 1);
  5.  
  6. uint16_t result = 0;
  7.  
  8. //maskbit for checking the state of position 16 14 13 11
  9. uint16_t maskBit = 0b0000000000101101;
  10.  
  11. result = LFSR & maskBit;
  12.  
  13. bit = LFSR ^ result;
  14.  
  15. LFSR = LFSR >> 1 | result << mask;
  16.  
  17. printf("%dt", LFSR);
  18. printInBinary(LFSR);
  19.  
  20. return LFSR;
Add Comment
Please, Sign In to add comment