05-01-2012 08:31 PM
Looking for some help with min / max module. I'm importing data via rs-232 from of profilometer into dasylab. The signal I get is similar to a sine wave. I need to get the min and max from each wave. I am able to do this using the min/max module and displaying it to a list. The problem I am having is getting the sample number of the max and min value that is displayed. I know the distance that each data point is taken, so I can count the data inputs and calculate the distance. I'm having trouble getting the correct sample number to align with the min max values.
I have tried writing to global variables and reading when the global variable changes, but it seems that I don't get the min and max values, it seems to report the first value when the data goes outside the hysteresis range.
I will attach program when I return to work in the morning
05-02-2012 05:47 AM
You want to count the cycles?
Use the Statistics/Counter module -- it can count samples, or if you use the TTL pulse mode of the Min/Max, it can count the edges.
05-02-2012 08:13 AM
I am able to count the samples. The problem I am having is getting the output from the min/max module and the counts to display in a list so that the max or min value has the corresponding data point.
Please see attached worksheet
05-02-2012 10:29 AM - edited 05-02-2012 10:31 AM
Hmm, i don't know if this is a valid solution, but it finds the same min/max-values with correct timestamps. 😉
05-03-2012 02:20 AM
And now some explanation (in a new posting because i cannot edit my previous one any more):
To get the calculated timestamp and the corresponding min/max-value in a list, both datastreams have to be synchronised. But the min/max-module's output is not continuous, when using the "put out the values"-option instead of the "put out a TTL-signal". It puts out the min/max-values if new ones are found, nothing if a received value is not a minimum or maximum.But branch with the data-timesample-calculation is a continuous datastream, because for each received sample it releases a one-sample-block with a calculated timestamp.
So, we have to capture the data of the timestamp-calculation and the raw data of the rs232-input module before the min/max-module, and guide it through a relais-module. The min/max-module with TTL-output-option controls the relais: only the values - with corresponding calculated timestamp - are written into the list.
But now, we have a problem: the min/max-modules TTL-output-option works only for incoming datastreams, that do not have the trigger-flag. But the RS232-module is not able to put out data without that flag set. So, a little detour is necessary: write the data that comes from the rs232-modul into a global variable, and use the Read variable-module to get the data back into the worksheet. Set the timebase of the Read variable-module to a useful value: eg if you send data requests in the rs232-module every two seconds, set the timebase (e.g. Driver) to 0,5 Hz, blocksize 1.
I do not know if there is a solution, that's... more beautiful. 😉
05-03-2012 05:52 AM
I haven't had a chance to dig into this, but your additional explanation makes me think of the Latch module.
You can have the Min / Max set up to do two channels, one Min, one Max, and, as you say, those are at two different times.
Connect to a latch and use a TTL input to release the Latch, and the Min/Max are now released with the same timestamp.
This is very different from a Relay! The relay requires synchronized inputs. The Latch does not.