Campbell Scientific AVW200 AVW200-series Vibrating Wire Interfaces - Page 93

Appendix H. Additional Programming Examples, H.1 AVW200-Controlled Multiplexer

Page 93 highlights

Appendix H. Additional Programming Examples H.1 AVW200-Controlled Multiplexer H.1.1 Direct RS-232 Connection 'This is an example of a program used by a CR1000 and AVW200 to control two AM16/32B multiplexers. 'Sixteen Geokon 4450 VW displacement sensors are attached to each multiplexer and each sensor 'provides a frequency, which is converted to displacement, and resistance, which is converted to 'temperature. Polynomial Gage Factors used in this example were taken from the calibration sheets of 'the individual 4450 sensors. The coefficients used 'to convert resistance to temperature are from the 'Steinhart-Hart equation. Public batt_volt,Ptemp Public Mux1(16,6) Public Mux2(16,6) Public VWResults(2) Public Amp1(16),Amp2(16) Public Temp1(16),Temp2(16) Public Therm1(16),Therm2(16) Public VWfreq1(16),VWfreq2(16) Public Sig2Noise1(16),Sig2Noise2(16) Public DecayRatio1(16),DecayRatio2(16) Public FreqOfNoise1(16),FreqOfNoise2(16) Public Displacement1(16),Displacement2(16) Dim i Dim j Dim Digits Dim ZeroRding(32) Dim GageFactor(32) Dim PolyCoef1(48) As Float Dim PolyCoef2(48) As Float Dim CoefString1(16) As String *30 Dim CoefString2(16) As String *30 Const A=.001403040 Const B=.000237318 Const C=.00000009 'Coefficients for Steinhart-Hart equation 'used to convert resistance to Temp DataTable (MuxExample,1,-1) DataInterval (0,10,Min,10) Minimum (1,batt_volt,FP2,0,False) Sample (16,Displacement1(),FP2) Sample (16,VWfreq1(),FP2) Sample (16,Temp1(),FP2) Sample (16,Amp1(),FP2) Sample (16,Sig2Noise1(),FP2) Sample (16,FreqOfNoise1(),FP2) Sample (16,DecayRatio1(),FP2) H-1

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112

Appendix H. Additional Programming
Examples
H.1 AVW200-Controlled Multiplexer
H.1.1 Direct RS-232 Connection
'This is an example of a program used by a CR1000 and AVW200 to control two AM16/32B multiplexers.
'Sixteen Geokon 4450 VW displacement sensors are attached to each multiplexer and each sensor
'provides a frequency, which is converted to displacement, and resistance, which is converted to
'temperature.
Polynomial Gage Factors used in this example were taken from the calibration sheets of
'the individual 4450 sensors.
The coefficients used 'to convert resistance to temperature are from the
'Steinhart-Hart equation.
Public batt_volt,Ptemp
Public Mux1(16,6)
Public Mux2(16,6)
Public VWResults(2)
Public Amp1(16),Amp2(16)
Public Temp1(16),Temp2(16)
Public Therm1(16),Therm2(16)
Public VWfreq1(16),VWfreq2(16)
Public Sig2Noise1(16),Sig2Noise2(16)
Public DecayRatio1(16),DecayRatio2(16)
Public FreqOfNoise1(16),FreqOfNoise2(16)
Public Displacement1(16),Displacement2(16)
Dim i
Dim j
Dim Digits
Dim ZeroRding(32)
Dim GageFactor(32)
Dim PolyCoef1(48) As Float
Dim PolyCoef2(48) As Float
Dim CoefString1(16) As String *30
Dim CoefString2(16) As String *30
Const A=.001403040
'Coefficients for Steinhart-Hart equation
Const B=.000237318
'used to convert resistance to Temp
Const C=.00000009
DataTable (MuxExample,1,-1)
DataInterval (0,10,Min,10)
Minimum (1,batt_volt,FP2,0,False)
Sample (16,Displacement1(),FP2)
Sample (16,VWfreq1(),FP2)
Sample (16,Temp1(),FP2)
Sample (16,Amp1(),FP2)
Sample (16,Sig2Noise1(),FP2)
Sample (16,FreqOfNoise1(),FP2)
Sample (16,DecayRatio1(),FP2)
H-1