Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static UINT16_T cn2, cn1, delta1;
- static UINT16_T cn5,cn4,cn3, dn5, dn3, dn1,dn0
- // lower half of figure 13, down sampled by 32
- cn5 = cn4 - dn5;
- cn4 = cn3 - dn3;
- cn3 = dn0 - dn1;
- dn0 = cn2;
- // top half of figure 13 - operates a bit rate
- M = 32; // decimation ratio for a bis width of 16 bits
- for(i=0; i<M; i++) {
- cn2 = cn2 + cn1;
- cn1 = cn1 + delta1;
- mout = get_next_bit(); // next ADS1106 bit from an imaginary FIFO
- delta1 = delta1 + (mout) ? 1 : 0;
- // delta1 = delta1 + (mout) ?1 : -1; Or maybe this?
- }
- M = 32/4; // processing 4 bits at a time
- for(i=0; i<M; i++) {
- cn2 = cn2 + cn1;
- cn1 = cn1 + delta1;
- nibble = get_next_nibble(); // next 4 bits
- bitcount = _builtin_popcount(nibble); // popcount returns the number of set bits
- delta1 = delta1 + bitcount;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement