S08 as a Digital Filter?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S08 as a Digital Filter?

3,236 Views
Andrey
Contributor III
I need to detect a frequency and an amplitude of a sound beep. I've seen some digital filter examples on the web but they are usually for other MCUs. Has anybody tried porting a digital filter for the S08? Does not have to be processed fast.
Labels (1)
0 Kudos
Reply
7 Replies

666 Views
Curt
Contributor IV
It looks like you have the chance to break some new ground here Andrey -- escpecially if you are talking about an 'RS08.  I would like to see what you come up with!
 
I have an ultrasonic transponder (28KHz), and have been thinking about how the 'RS08 might be used to process the receive signals -- so will be interested in what you come up with.
0 Kudos
Reply

666 Views
Andrey
Contributor III
I'm going to use 9S08AW60. Here's an article from Circuit Cellar that describes an Audio Spectrum Analyzer using a PIC processor. See http://www.circuitcellar.com/library/print/0998/Lacoste98/index.htm
0 Kudos
Reply

666 Views
Encoder
Contributor I
I don't know if it can be useful, at least to me, but it is simply "impressive"!
 
A simple comparison of the original Lacoste's PIC17C756 to the more modern 9S08AW60 shows a clear advantage of the latter for the hardware power (it has nearly 4 times as much rom and even more ram), a better set of code instructions which will perhaps permit simpler programs but nearly the same speed or only slightly more: infact the mean instruction time lenght of the 9S08 core is nearly 3 clock pulse which compares with slightly more than 1 for the PIC. So 8MHz of the original PIC clock could compare with 20MHz that is the maximum for the AW.
 
The Author did succeed in achieving a nearly 16kHz sample frequency with 10 banks of processed 256 sample per second: 10 screen/second on a VGA screen with no other chip than the PIC and an LM324. This implies that the maximum frequency which can be processed in base band is nearly 8kHz, from the Nyquist rule. Still no other word than impressive!
 
This result and perhaps a little better, may be reasonably achieved by the AW60 but, I think, with a considerable effort and some purposely built fixed point math routines. Are you ready to design your own sine and log routines? I am not sure you may easely manage all timely tasks without some jitter, without some buffering. Some external chip could probably help you achieve 3 or 4 times better results, i.e. 2 cpu with separate tasks. I definitely think that nothing smaller than an AW16-60 may reasonably manage a similar task or it's worth it. I think that even the more powerful 'RS08 has not enough resources to do the task at whatsoever frequency and anyway the game isn't worth the candle!
 
And now an important question.... Did you succeed in retrieving the original code of the Lacoste's article issued in 1998? I did't. It could be very helpful as an example or to try a porting without starting from scratch. If you did, can you write down the link?
 
Regards,
Encoder
0 Kudos
Reply

666 Views
Andrey
Contributor III
I was not able to get the code either. But searching around I came acrossa FFT algorithm fro HC11, here: http://www.freescale.com/files/archives/software/app_software/code_examples/FFTHC11COD.zip

In the comments for the code he writes "The results are an impressive 350 miliseconds per transform". I'll be taking a look at this code. It is in assembly, and I'm not sure yet, how HC11 specific is it.

Like I mensioned before, my application is not time sensitive, so if I spend even 2 seconds to calculate the frequency, it's ok.

Here's another take at Audio Spectrum monitor:
http://elm-chan.org/works/akilcd/report_e.html using Atamega. Some stats about that chip:
  • 8-Kbyte self-programming Flash Program Memory,
  • 1-Kbyte SRAM, 512 Byte EEPROM,
  • 6 or 8 Channel 10-bit A/D-converter.
  • Up to 16 MIPS throughput at 16 Mhz. 2.7 - 5.5 Volt operation.
0 Kudos
Reply

666 Views
Andrey
Contributor III
Ok, here is Lacoste's document describing the routines.
http://www.alciom.com/fr/download/RL0325-001%20fftpic18%201B.pdf

and the routines:
ftp://ftp.circuitcellar.com/pub/Circuit_Cellar/1998/Issue_98/
under picspectrum.zip

He also says that "FFTPIC allows to calculate a 256 points FFT on 16 bits in less than 50ms" His code is based on Microchips App note. 542
0 Kudos
Reply

666 Views
J2MEJediMaster
Specialist I
Here is the code for Motorola's DSP56824 on an evaluation board that had an audio codec. Given the proper coefficients, it could filter for specific frequencies on an audio stream in real time. You want to look at the function fir_filter(), which is where the filtering takes place. It assumes fixed point arithmetic and data types. It may not be exactly what you need, but it's written in C. You might also want to check out the book, listed in the comments, where I got the original code. HTH.

---Tom
0 Kudos
Reply

666 Views
Andrey
Contributor III
Thank you Tom,

The picture is getting clearer now.  Although I will probably end up writing HCS08 specific code, I begin to see a patern, even among different chips. I'll keep on posting if I find something interesting.
Here's a great website that has DSP code in C. (You have to register, but it's free)
http://www.dspstore.com/x_index.asp look under "Algorithms"
0 Kudos
Reply