[sdiy] Quick C query

Eric Brombaugh ebrombaugh1 at cox.net
Sun Nov 21 19:18:52 CET 2010


On 11/21/2010 09:57 AM, Tom Wiltshire wrote:
>> Once you see the light you'll wonder why you never jumped before!!!
>
> I sincerely hope so! It'd be nice to work in something that produced results quicker than assembly. I doubt I'll ever leave "hand-tweaked" behind for audio-rate stuff though.

I've been coding dsPIC in a combination of C & assembly for the last few 
years. It works pretty nicely - using the C mainly for low-priority 
setup & background processing, as well as complex conditional stuff 
that's harder to keep track of in assembly when all you've got is branch 
instructions. Amazing how much using braces {} and whitespace helps to 
clarify the flow.

High-priority & DSP stuff that the C compiler doesn't deal with 
efficiently then goes into hand-coded assembly subroutines. I've also 
been using their DSP library, as well as extending it with my own 
functions that use the same API.

This approach also makes it more practical to incorporate some of the 
other libraries that are available, like MCHP's SD card access code. 
Makes it easy to use huge filesystems for waveform storage, FPGA code, etc.

There was some talk a while back of using dsPIC DMA to handle 
buffer-oriented processing of audio samples. I started a project along 
this line recently and it's been working nicely. There are some pretty 
easy-to-use examples in the DCI documentation that can get you going 
without a lot of effort. Most of the executive code in this project is 
in C with a number of hand-tuned DSP subroutines to handle buffer 
processing. It's seems to be pretty efficient, even with the C calling 
overhead.

Recommended.

Eric



More information about the Synth-diy mailing list