SHARE
TWEET

Untitled

a guest Mar 21st, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static UINT16_T cn2, cn1, delta1;
  2. static UINT16_T cn5,cn4,cn3, dn5, dn3, dn1,dn0
  3.  
  4. // lower half of figure 13, down sampled by 32
  5. cn5 = cn4 - dn5;
  6. cn4 = cn3 - dn3;
  7. cn3 = dn0 - dn1;
  8. dn0 = cn2;
  9.  
  10. // top half of figure 13 - operates a bit rate
  11. M = 32;  // decimation ratio for a bis width of 16 bits
  12. for(i=0; i<M; i++) {
  13.   cn2 = cn2 + cn1;
  14.   cn1 = cn1 + delta1;
  15.   mout = get_next_bit();  // next ADS1106 bit from an imaginary FIFO
  16.   delta1 = delta1 + (mout) ? 1 : 0;
  17.   // delta1 = delta1 + (mout) ?1 : -1;  Or maybe this?
  18. }
  19.      
  20. M = 32/4;  // processing 4 bits at a time
  21. for(i=0; i<M; i++) {
  22.   cn2 = cn2 + cn1;
  23.   cn1 = cn1 + delta1;
  24.   nibble = get_next_nibble();  // next 4 bits
  25.   bitcount = _builtin_popcount(nibble);   // popcount returns the number of set bits
  26.   delta1 = delta1 + bitcount;
  27. }
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