Tuesday, February 19, 2013

C reverse bits in unsigned integer and All about BITS TWIDDLE HACKS

http://graphics.stanford.edu/~seander/bithacks.html
http://stackoverflow.com/questions/9144800/c-reverse-bits-in-unsigned-integer

Reversing the bits in a word is annoying and it's easier just to output them in reverse order. E.g.


void write_u32(uint32_t x)
{
    int i;
    for (i = 0; i < 32; ++i)
        putchar((x & ((uint32_t) 1 << (31 - i)) ? '1' : '0');
}
Here's the typical solution to reversing the bit order:
uint32_t reverse(uint32_t x)
{
    x = ((x >> 1) & 0x55555555u) | ((x & 0x55555555u) << 1);
    x = ((x >> 2) & 0x33333333u) | ((x & 0x33333333u) << 2);
    x = ((x >> 4) & 0x0f0f0f0fu) | ((x & 0x0f0f0f0fu) << 4);
    x = ((x >> 8) & 0x00ff00ffu) | ((x & 0x00ff00ffu) << 8);
    x = ((x >> 16) & 0xffffu) | ((x & 0xffffu) << 16);
    return x;
}

Wednesday, January 23, 2013

Tuesday, January 22, 2013

TMP 006 Breakout Board Build

Build
http://www.youtube.com/watch?v=8fXjTh1MMws
Test
http://www.youtube.com/watch?v=GEGiEi6tcVo&NR=1

TI Temperature Sensing Product line. 

Thursday, January 17, 2013

Signal Conditioning Piezoelectric Sensors

http://www.ti.com/lit/an/sloa033a/sloa033a.pdf

Mini Piezo Siren

http://www.rebelhosts.com/tt/te/p59.htm

Piezoelectric Tutorial From Physics to Ardurino
http://www.eng.utah.edu/~cs5968/handouts/piezo.pdf



Piezoelectric Amplifier Circuit

http://hackedgadgets.com/2009/05/06/piezoelectric-amplifier-circuit/

Sensing Amplifier Circuit


Transistor High Side Switching Interface

http://www.w9xt.com/page_microdesign_pt8_pnp_switching.html

Transistor Switching example
http://www.kpsec.freeuk.com/trancirc.htm

Transistor Tutorial

http://www.electronics-tutorials.ws/transistor/tran_1.html

How Piezo Buzzer works

http://www.engineersgarage.com/insight/how-piezo-buzzer-works?page=1