CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Recursive filter - making it go faster

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nazoa



Joined: 09 Feb 2007
Posts: 55

View user's profile Send private message

Recursive filter - making it go faster
PostPosted: Sat Sep 11, 2010 7:56 am     Reply with quote

I have code for a recursive low pass filter which is working OK but I need to increase its speed. The line which is taking too long is the following:

filt1 = filt1 - ( filt1 >> 4 ) + ad_ref;

In this, filt1 and ad_ref are 32bit unsigned integers. A long shot, but I was wondering if anyone can suggest a way of getting this simple code to go faster. At the moment I am running the PIC at 40MHz and the line executes in a little under 5us.

Thanks
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sat Sep 11, 2010 11:32 am     Reply with quote

I count exactly 46 instruction cycles (4.6 us). int32 arithmetic is quite bulky with PIC18, I don't see an option to speed it up. Switching to assembly coding can't save more than a few register load operations. If you don't need actually 32 bit, there would be room for timing optimizations.

Or use a faster processor, e.g. PIC24.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group