Section 8. Processing and Math Instructions
8-21
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 PeakV(2), Change(3),Deg
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)
PeakValley(PeakV(1),Change(1),2,XY(1),0.1) ‘Find the peaks and
‘valleys for both
‘inputs. Hysteresis
‘= 0.1
CallTable PV1
CallTable PV2
CallTable PVBoth
Next Scan
EndProg
Содержание CR5000
Страница 39: ...Section 1 Installation and Maintenance 1 15 S A N Y O FIGURE 1 11 6 Removal of band clamp and battery ...
Страница 40: ...Section 1 Installation and Maintenance 1 16 This is a blank page ...
Страница 54: ...Section 2 Data Storage and Retrieval 2 14 This is a blank page ...
Страница 88: ...Section 4 CRBasic Native Language Programming 4 12 This is a blank page ...
Страница 94: ...Section 5 Program Declarations 5 6 This is a blank page ...
Страница 172: ...Section 7 Measurement Instructions 7 46 This is a blank page ...
Страница 206: ......
Страница 236: ...Index Index 4 This is a blank page ...
Страница 237: ...This is a blank page ...