Campbell Scientific WINDSONIC1 WINDSONIC 2-D Sonic Wind Sensors - Page 42
New CR1000 Program Old CR1000 SDM-SIO1 Program of 7/10 WindSonic manual
View all Campbell Scientific WINDSONIC1 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 42 highlights
Appendix B. Updating an Older Program for Measuring a WindSonic1 With the New Settings New CR1000 Program (Section 7.3.1) (Public variables change. Data table structure stays the same.) Dim windsonic(4) As String Public wind_direction Public wind_speed Public diag Public nmbr_bytes_rtrnd Units wind_direction = degrees Units wind_speed = m/s Units diag = unitless Dim in_bytes_str As String * 21 Dim checksum_flg As Boolean Dim disable_flg As Boolean Dim n Units n = arb BeginProg n = 1 SerialOpen (Com1,9600,3,0,105) Scan (1,Sec,3,0) 'Get data from WindSonic. SerialInRecord (Com1,in_bytes_str,&h02,0,&h0D0A,nmbr_bytes_rtrnd,01) SplitStr (windsonic(),in_bytes_str,",",4,4) 'Split the string and convert to floats. wind_direction = windsonic(1) wind_speed = windsonic(2) diag = windsonic(4) checksum_flg = ( (HexToDec (Right (in_bytes_str,2))) EQV (CheckSum (in_bytes_str,9,Len (in_bytes_str)-3)) ) disable_flg = ( NOT (checksum_flg) OR (nmbr_bytes_rtrnd=0) OR(diag0) ) Old CR1000 SDM-SIO1 Program (Section 6.2 of 7/10 WindSonic manual) (Public variables change. Data table structure stays the same.) Public windsonic(4) Alias windsonic(1) = wind_direction Alias windsonic(2) = wind_speed Alias windsonic(3) = diag Alias windsonic(4) = nmbr_bytes_rtrnd Units wind_direction = degrees Units wind_speed = m/s Units diag = unitless Dim in_bytes_str As String * 21 Dim checksum_flg As Boolean Dim disable_flg As Boolean Dim n Units n = arb BeginProg n = 1 SerialOpen (40,38400,3,0,49) 'SDM-SIO1 SDM address set to 8. Scan (1,Sec,3,0) 'Get data from WindSonic. SerialInRecord (40,in_bytes_str,&h02,0,&h0D0A,nmbr_bytes_rtrnd,00) wind_direction = Mid (in_bytes_str,3,3) wind_speed = Mid (in_bytes_str,7,6) diag = Mid (in_bytes_str,16,2) checksum_flg = ( (HexToDec (Mid (in_bytes_str,20,2))) EQV (CheckSum(in_bytes_str,9,18)) ) disable_flg = (NOT (checksum_flg) OR (nmbr_bytes_rtrnd=0) OR (diag0)) B-2