
Section 8. Processing and Math Instructions
Parameter
& Data Type
Enter
Source
Variable or
Array
The variable or array containing the inputs to check for peaks and valleys.
Hysteresis
Constant
Variable or
expression
The minimum amount the input has to change to be considered a new peak
or valley. This would usually be entered as a constant.
The following example uses sine and cosine signal inputs to illustrate the use
of PeakValley with two repetitions. Data Table PV1 stores the peaks and
valleys from the cosine wave. PV2 stores the peaks and valleys from the sine
wave. PV3 stores the peaks and valleys from both.
Public Dim XY(2)
Const Pi=4*ATN(1) ‘Define Pi for converting degrees to
radians
DataTable(PV1,Change(1),500) ‘Peaks and valleys for first signal,
triggered when ‘Change(1) is not 0.
Sample(1,PeakV(1),IEEE4) ‘DataTable PV1 holds the peaks and
valleys for XY(1)
EndTable
DataTable(PV2,Change(2),500) ‘Peaks and valleys for second signal,
triggered when ‘Change(2) is not 0.
Sample(1,PeakV(2),IEEE4) ‘DataTable PV2 holds the peaks and
valleys for XY(2)
EndTable
‘The Following table is an alternative to using separate tables for each signal.
‘It stores both signals whenever there is a new peak or valley in either signal.
‘The value stored for the signal that does not have a new peak will be a repeat
‘of its last peak or valley. Normally a program would not have a table storing
‘peaks and valleys for several signals, it would use individual tables for the
‘signals.
DataTable(PVBoth,Change(3),500)
Sample(2,PeakV(1),IEEE4)
EndTable
BeginProg
Scan(500,mSec,0,0)
Deg=Deg+5
XY(1)=Cos(Deg*Pi/180) ‘Compute the cosine as input XY(1)
XY(2)=Sin(Deg*Pi/180) ‘Compute the sine as input XY(2)
8-23
Comentários a estes Manuais