Xlinkers Home

PDM microphone

Bookmark and Share

Description:

The simplest possible sigma delta pulse counter for a microphone that outputs PDM pulses (like National Semi's discontinued LMV1024/6)

As an example, this code converts mic output to 8-bit unsigned PCM at about 22 kHz. This is then output as 16-bit signed PCM to XDK's audio DAC and resampled to 44.1 kHz.

The relevant code sequence is

// Snippet 1
case data :> unsigned z:
s += cnt1s[z];
n += 8;

and

// Snippet 2
case slave { dac <: x; dac <: x; }:
unsigned x = (n > 0) ? (256 * s / n) : 0;
n = 0;
s = 0;


.

Snippet 1 inputs 8 pulses (data port is configured for 1:8 deserialisation) and updates the sum (cnt1s counts ones in a character)

Snippet 2 computes 8-bit unsigned sample value from the sum (sample is set to zero if no pulses were available in order to avoid zero division).

See test.xc for full listing

DOWNLOAD
Source Files
NameLast changed
codec.h10-11-2009 17:11:41
codec.xc10-11-2009 17:11:41
makefile10-11-2009 17:11:41
test.xc10-11-2009 17:11:41

Tags:

User login

Affiliate sites

affiliate

Advertisments

affiliate

Recent Projects

Go to projects page