HW Filter to ADC project

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

 Hi all, 

   

I am looking to sample 8 inputs, filter and ADC to the PSoC5 LP. I am interested to have access to them internally not output any values to the DAC ( as the project example shows). My filter needs to ve a very low frequency low pass ( something in the region of 10Hz or lower)

   

I have not managed to read the data internally ( ideally and display to LCD) yet so any help is greatly appreciated. 

   

 

   

Thanks! 

0 Likes
8 Replies
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Consider posting your project, makes life easier to troubleshoot.

   

 

   

“File”                                                             Creator

   

“Create Workspace Bundle”

   

 

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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.

   

 

   

Bob

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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

   

A/D.

   

 

   

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

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? 

   

Thanks again! 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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 -

   

 

   

www.cypress.com

   

“Support”

   

“Technical Support”

   

“Create a Case”

   

 

   

You have to be registered on Cypress web site first.

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

 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. 

   

Thanks! 

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

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

   

and discussions.

   

 

   

Also use volatile to declare variables used inside ISRs -

   

 

   

    

   

          

   

http://www.barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword    Volatile

   

   

 

   

Regards, Dana.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Some thoughts here

   

 

   

Bob

0 Likes