This is a pseudo-mirror of www.bores.com DSP intro at http://www.bores.com/courses/intro/program/7_real.htm [sic] as per the policy of this site.
This mirror was created from the source on 03/08/2000 at 22:46 Central Time.
Commercial information, time-dependent information, and all the damn JAVA scripts have been removed.  All "htm" extensions have been changed to the proper "html" extensions.  Has also been edited for coherence, proper-linkage, and better document flow.
Copied without permission.




go back to start of module go back to previous page go to next page go to next module

BORES logo

Introduction to DSP

Programming a DSP processor

Real time

Both the naive FIR filter program and its more efficient version assume we can access the whole array of past input values repeatedly:

But this is not the case in real time. Real time systems face a continuing stream of input data: often, they have to operate on one input sample at a time and generate one output sample for each input sample:

A similar restriction is likely if the filter program is implemented as a subroutine or function call. Only the current input and output are available to the filter so the filter function itself has to maintain some history of the data and update this history with each new input sample. Management of the history takes up some processing time.

The filter needs to know the most recent [N] input samples. So the real time filter has to maintain a history array, which is updated with each new input sample by shifting all the history data one location toward 0:

The necessary updating of the history array involves simply adding two extra lines to the C program, to implement the array shifting:

The pointer to previous input samples, *x_ptr, is replaced by a pointer to the history array, *hist_ptr.A new pointer, *hist1_ptr, is initialised to point one further down the history array and is used in the shifting of data down the array.

The two extra lines of C code represent extra computation: actually, the filter now takes two lines of C code instead of one for the inner loop.

copyright

| Last updated: 13th January 1997 | http://www.bores.com/courses/intro/program/7_real.htm


Fordwater, Pond Road, Woking, Surrey GU22 0JZ
Telephone: 01483 740138 fax: 01483 740136 email: Email address for Bores Web: http://www.bores.com