View previous topic :: View next topic |
Author |
Message |
MOLLY Guest
|
Time from max to max value in a sinus like wave |
Posted: Tue Apr 08, 2003 6:55 am |
|
|
Hello dear programmers.
Please excuse my poor English
I've got a problem that I need to work out, please help me!
I've tried and tried to work out a code that maesures the time from one max value to the next. But I just can't make it happend. So can anybody help me with the code. It's not a student project, so PLEASE help me!!!
I'm getting a sinus like value but a bit more uneven. And I need the time from the first to the next value. How can I put a tag on the first one and then the next one so I can get the time between. I have seen the ansvers to the other simular questions but it does not help me!
Thank you so much Molly
___________________________
This message was ported from CCS's old forum
Original Post ID: 13493 |
|
|
Sherpa Doug Guest
|
Re: Time from max to max value in a sinus like wave |
Posted: Tue Apr 08, 2003 7:01 am |
|
|
:=Hello dear programmers.
:=Please excuse my poor English
:=I've got a problem that I need to work out, please help me!
:=
:=I've tried and tried to work out a code that maesures the time from one max value to the next. But I just can't make it happend. So can anybody help me with the code. It's not a student project, so PLEASE help me!!!
:=I'm getting a sinus like value but a bit more uneven. And I need the time from the first to the next value. How can I put a tag on the first one and then the next one so I can get the time between. I have seen the ansvers to the other simular questions but it does not help me!
:=
:=Thank you so much Molly
Rather than max to max it is easier to find zero crossings. If what you want is period or frequency the zero crossings will give you the same answer with more accuracy than maximums. Maximums are very susceptable to noise.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13494 |
|
|
Tomi Guest
|
Re: Time from max to max value in a sinus like wave |
Posted: Tue Apr 08, 2003 9:09 am |
|
|
Doug has absuletely right. The slope of a sine wave is zero at the max/min values. This means a very poor accuracy in time measurement. The sine wave has the maximum slope at zero cross so this point is ideal for time measurement :)
:=Rather than max to max it is easier to find zero crossings. If what you want is period or frequency the zero crossings will give you the same answer with more accuracy than maximums. Maximums are very susceptable to noise.
:=
___________________________
This message was ported from CCS's old forum
Original Post ID: 13499 |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
Re: Time from max to max value in a sinus like wave |
Posted: Tue Apr 08, 2003 5:06 pm |
|
|
<font face="Courier New" size=-1>:=Doug has absuletely right. The slope of a sine wave is zero at the max/min values. This means a very poor accuracy in time measurement. The sine wave has the maximum slope at zero cross so this point is ideal for time measurement <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">
:=
:=:=Rather than max to max it is easier to find zero crossings. If what you want is period or frequency the zero crossings will give you the same answer with more accuracy than maximums. Maximums are very susceptable to noise.
:=:=
Depends on the application surely.
What about the example of blood pulse rate measurement (BPM) where the "DC" can shift wildly? eg inflated cuff pressure sensing where the initial pressure is different each time and changes when the patient moves.
OK, maybe some hardware tidying up of the signal first would help then maybe zero crossing detection would work.
With measuring maximums a measurement should be possible. I would apply a spike removal filter to the sampled values, then a median filter to a series of measurements to smooth things out a bit. I have used the routines posted by PCM Programmer to good effect in similar situations eg. hot wire sensing of air flow rate in an engine intake and tacho measurement smoothing.
My colleague has done a similar project successfully. The application was to measure the loads on each wheel of moving ore trains, and also to calculate their speed. The sensors were strain gauges on the rails, so the DC value was not fixed. Spikes caused by flat spots on the wheels were removed by filtering of the values as above. Zero crossing was not an option in this job.
Regards
Kenny</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 13515 |
|
|
MOLLY Guest
|
But how do I do it |
Posted: Tue Apr 08, 2003 5:45 pm |
|
|
This sounds great. But how do I do this? There is nothing about this in the CCSC.pdf or I can't find it. So do anybody have a simple, sample program that measures time between two max values? The value I'm getting is between 1-4 V
Thank you so much
___________________________
This message was ported from CCS's old forum
Original Post ID: 13518 |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
Re: But how do I do it |
Posted: Tue Apr 08, 2003 6:26 pm |
|
|
:=This sounds great. But how do I do this? There is nothing about this in the CCSC.pdf or I can't find it. So do anybody have a simple, sample program that measures time between two max values? The value I'm getting is between 1-4 V
:=
:=Thank you so much
I explained the basic method in an earlier thread. However I think this project is non-trivial for people without much microcontroller experience, especially the refinements to get it to work well.
Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 13519 |
|
|
Tomi Guest
|
Re: Time from max to max value in a sinus like wave |
Posted: Wed Apr 09, 2003 12:55 am |
|
|
:=What about the example of blood pulse rate measurement (BPM) where the "DC" can shift wildly?
ABPMs (Automatic Blood Pressure Monitors) work differently. It waits for PEP (pre-ejection pulse) what is a big-big rising slope (typically 1:100 rate). Then select the biggest value before the incisura point what is mathematically an inflexion point. Then catch the next maximum and divide it by the previous max. value to distinguish between arteria sterosis and insufficientia, etc. and to calculate PEP/LVET, Weissler indexes, etc. (Some commonly used ABPM evaluation software written by myself for Macintosh platform )
___________________________
This message was ported from CCS's old forum
Original Post ID: 13524 |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
Re: Time from max to max value in a sinus like wave |
Posted: Wed Apr 09, 2003 1:06 am |
|
|
:=:=What about the example of blood pulse rate measurement (BPM) where the "DC" can shift wildly?
:=
:=ABPMs (Automatic Blood Pressure Monitors) work differently. It waits for PEP (pre-ejection pulse) what is a big-big rising slope (typically 1:100 rate). Then select the biggest value before the incisura point what is mathematically an inflexion point. Then catch the next maximum and divide it by the previous max. value to distinguish between arteria sterosis and insufficientia, etc. and to calculate PEP/LVET, Weissler indexes, etc. (Some commonly used ABPM evaluation software written by myself for Macintosh platform <img
src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0"> )
Excellent. I'm impressed, truly.
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 13525 |
|
|
Sherpa Doug Guest
|
Re: But how do I do it |
Posted: Wed Apr 09, 2003 7:08 am |
|
|
:=This sounds great. But how do I do this? There is nothing about this in the CCSC.pdf or I can't find it. So do anybody have a simple, sample program that measures time between two max values? The value I'm getting is between 1-4 V
:=
:=Thank you so much
[bowing to Tomi's apparent expertice]
If you must measure from Max to Max you could do it this way:
You will certainly need to filter the data. While doing that differentiate it as well (store differences between consecutive readings instead of actual readings). Differentiating removes DC and will turn well behaved maxima into zero crossings. Then just process as for zero crossings.
___________________________
This message was ported from CCS's old forum
Original Post ID: 13536 |
|
|
|