Go to Post Teach them to fish by catching the first fish for them. (Give them the answer, but also give them how you came to that conclusion) - David V [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 14-02-2008, 19:53
windell747 windell747 is offline
Registered User
FRC #2477
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2001
Location: Hawaii
Posts: 158
windell747 will become famous soon enoughwindell747 will become famous soon enough
integer print not making any sense.

Hi, We are implementing a simple digital moving average filter of the output of the p1_y and p1_x. We are pretty much summing 8 numbers that should be in the range of 0-30 therefore should get an output of around 0-240...however this isn't the case for us. We are getting an output of something in the 7000s.

Thanks for your help!
Windell

Below is the code:
Quote:
(at top of user_routines.c)
unsigned int yminus1,yminus2,yminus3,yminus4,yminus5,yminus6,ym inus7;
unsigned int tempy;

(outside of any of the functions in custom_routines.c)
extern unsigned int yminus1,yminus2,yminus3,yminus4,yminus5,yminus6,ym inus7;
extern unsigned int tempy;

/************************************************** **************************/
/*implement a moving average filter to eliminate some of the noise of the p1 ADC*/
/************************************************** **************************/
tempy=(int)p1_y+yminus1+yminus2+yminus3+yminus4+ym inus5+yminus6+yminus7;
yminus7=yminus6;
yminus6=yminus5;
yminus5=yminus4;
yminus4=yminus3;
yminus3=yminus2;
yminus2=yminus1;
yminus1=p1_y;

printf("tempy %d\r",tempy);
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP any tips for making promotional videos efoote868 Fundraising 3 19-07-2006 23:19
Ok, this does not make sense.... Michael Hill Math and Science 6 19-10-2005 17:42
integer division ImmortalAres Programming 5 11-07-2005 21:19
Kickoff is running again, @ 11:50 am - NOT ANY MORE!!! :( Elgin Clock General Forum 4 08-01-2005 22:30
Integer Number powercat Programming 2 18-02-2003 11:26


All times are GMT -5. The time now is 20:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi