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

about controlling voltage monotony

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
see it plz...
Guest







about controlling voltage monotony
PostPosted: Tue May 11, 2004 5:37 am     Reply with quote

i have to control the monotony of voltage acquisition with 16F876 during 10ms however i sets the timer2 to sample voltage every 100us then i will compare voltage[i]<voltage[i+1]<voltage[i+2] ...... so should i declare a table of 100 case where i will store samples to compare them?
i have the idea but i can't realize it.
so anyone help me.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue May 11, 2004 7:20 am     Reply with quote

I'm confused.... Do you want to measure the STABILITY of a voltage over a 10ms period? There are algorythms to calculate the Standard Deviation of a string of readings without having to store every reading in an array. I know my pocket calculator can find the SDEV of more numbers than it has memory to store.
_________________
The search for better is endless. Instead simply find very good and get the job done.
see it plz...
Guest







re
PostPosted: Tue May 11, 2004 7:26 am     Reply with quote

no, i want to control the evolution monotony of the voltage like this
if ((read_ADC[i]<=read_ADC[i+1]) && (read_ADC[i+1]<=read_ADC[i+2]) && ((read_ADC[i+2]<=read_ADC[i+3]))
output_high(led1);
else output_high(led2);


so how can i store 100 values of voltage to perform the comparison between them.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Tue May 11, 2004 7:52 am     Reply with quote

Unless you are controlling a missil head director, I would average consecutive AD
readings and according to the resulting tendency take an action. Why so fast ??

Regards,

Humberto
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Tue May 11, 2004 9:03 am     Reply with quote

It seems like an application I once had where an instrument was lowered into the ocean by a winch. The winch was occasionally stopped and that was supposed to trigger the instrument to take readings at each stopping point. A pressure sensor monitored depth and when it stopped getting deeper the instrument took measurements. With the heaving of the ship and the erratic behavior of the winch it required a lot of filtering to prevent false triggers.

Anyway, I see two methods. First just use an array of readings. Any book on C will tell you how to use an array. If you don't have enough memory a less flexable way would be to just store the last reading and compare to the current reading to get a differential. If the differential is positive then increment a counter. If the differential is neagtive then zero the counter. When the counter = 100 you have "evolution monotony."
_________________
The search for better is endless. Instead simply find very good and get the job done.
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