Consider posting your project, makes life easier to troubleshoot.
“Create Workspace Bundle”
A 10Hz filter can easily be built in software, so your signal chain would look like
8 Analog pins -> Analog Mux -> ADC -> software filter -> further processing / logging
and some additional components to enure synchronization and time keeping.
Some questions -
1) Do you want to graph the data ?
2) What is resolution, accuracy, you want in the A/D and Data ?
3) Display and filter all channels simultaneously ?
4) Rough idea of filter performance needed, eg. stop band specs.
You cannot just place mux into A/D then filter sequentially each channel
without a lot of latency. There is however a means to accoplish simultaneous
filtering (at low data rates as you mentioned) by using DFB and the DFB
Asembler to implement a many channel filter array. More complex than if you
filter one channel for a while (its settling time x N) and live with latency
channel to channel.
For case where you do not need simultaneous filtering consider the example
project and justy drop the dma to the VDAC and VDAC. And mux the inout to the
Thanks so much for all replies! I was planning to used the hardware filter for speed - I thought it should be faster to MUX -> ADC -> Filter in HW than doing a moving average in software. This seems like it's not the case.
My system is fairly complex, it will be running a few PWM motor controllers, I2C comms (master and slave) counters/ timers and the ADC, Filter and Mux - this is to say that it will not only be doing the ADC/Filter/Signal Processing.
The other option of using aDFB is very appealing but I have never written a filter in assembly ( I have good experience with filters, both analog and digital, but at a higher level than assembly.) I think if I can get a good moving average DFB set up it would be enought for my needs at the moment.
It should be pretty simple - make a 10 element vector. Wait to fill it up and divide by 10 - I suppose, looking at the example, it could be made to take 2 inputs/ DFB in and produce 2 outputs. However, having no experience with assembler it not the easiest of examples. Do you know of any simple example implementation using the DFB?
Maybe some of this will help -
http://www.cypress.com/?rID=60720 DFB Assembler, MAC Topics
http://www.cypress.com/?app=forum&id=2492&rID=76907 DFB Assembler
https://www.youtube.com/watch?v=2UC4gCohrk8 DFB Video Part I
https://www.youtube.com/watch?v=6tr_CNWIA8M DFB Video Part II
https://www.youtube.com/watch?v=nIa4X7gES3k DFB Video Part III
Consider filing a CASE and asking for some code examples -
To create a technical or issue case at Cypress -
“Create a Case”
You have to be registered on Cypress web site first.
Thanks for all the help - much appreciated.
I have another question - what happens if I declare some of my variabled outside the main loop? I am looking to create some functions ( more like wrapper fct) just for the sake of lisibility and I need to declare most variables outside the main loop for the functions to work.
If you declare variables outside of main() then they become global
variables. There are several discussions in forums about global
vs local. Generally speaking your preferred approach is to use locals
and pass by value or reference.
Using globals can be difficult to debug if you have several f()s using/
modifiying them, so be careful.
But there are occasions where globals can result in code reduction,
especially when pointers are used on non native machine integers.
Google "c language global vs local" and you will get a number of hits
Also use volatile to declare variables used inside ISRs -