Hi
First of all, I know there are some mistakes in my program and I need your help. where the mistakes are the average and STD of the wind direction, in addition I want to show on the modbus the output data every second without save it on the memory of the datalogger, Can I do it?
In addition, I an wondering if I can show every sec / every 10 min / every hour / every day on the modbus.
Kindly find below my program.
your immediate response will be highly appreciated
'Declare Public Variables
'----------------------------------------------------------
Public Panel_Temp
Public BatteryVoltage
Public BarometricPressure_10m
Public AirTemperature_10m, AirTemperature_68m
Public RH_10m,RH_68m
Public WS_29m,WS_31m,WS_68m,WS_70m
Public WindRun_29m,WindRun_31m, WindRun_68m, WindRun_70m
Public WD_31m ,WD_68m
Units BarometricPressure_10m =hPa
Units BatteryVoltage =Volts
Units WS_29m,WS_31m,WS_68m,WS_70m = m/s
Units WD_31m ,WD_68m=Deg
Units AirTemperature_10m, AirTemperature_68m=DegC
Units RH_10m,RH_68m = %
Units WindRun_29m,WindRun_31m, WindRun_68m, WindRun_70m =Meters
Units Panel_Temp =DegC
'------------------------------------------------------
'Wind Array of Ultrasonic #1 Telegram 6(29 Meters)
Public US1_wind(10) As Float
Alias US1_wind(1) = US29m_P8' Wind Velocity X Component
Alias US1_wind(2) = US29m_P9' Wind Velocity Y Component
Alias US1_wind(3) = US29m_P10' Wind Velocity Z Component
Alias US1_wind(4) = US29m_P11' Total Wind Velocity
Alias US1_wind(5) = US29m_P12'Wind Velocity Azimuth
Alias US1_wind(6) = US29m_P13'Wind Direction Azimuth
Alias US1_wind(7) = US29m_P14'Wind Direction Elevation
Alias US1_wind(8) = US29m_P45'Turbulence X
Alias US1_wind(9) = US29m_P46'Turbulence Y
Alias US1_wind(10)= US29m_P47'Turbulence Z
Units US29m_P8 = ms-1
Units US29m_P9 = ms-1
Units US29m_P10= ms-1
Units US29m_P11= ms-1
Units US29m_P12= ms-1
Units US29m_P13= Deg
Units US29m_P14= Deg
Units US29m_P45= ms-1
Units US29m_P46= ms-1
Units US29m_P47= ms-1
'--------------------------------------------------------
'------------------------------------------------------
'Wind Array of Ultrasonic #2 Telegram 6 (66 Meters)
Public US2_wind(10) As Float
Alias US2_wind(1) = US66m_P8' Wind Velocity X Component
Alias US2_wind(2) = US66m_P9' Wind Velocity Y Component
Alias US2_wind(3) = US66m_P10' Wind Velocity Z Component
Alias US2_wind(4) = US66m_P11'Total Wind Velocity
Alias US2_wind(5) = US66m_P12'Wind Velocity Azimuth
Alias US2_wind(6) = US66m_P13'Wind Direction Azimuth
Alias US2_wind(7) = US66m_P14'Wind Direction Elevation
Alias US2_wind(8) = US66m_P45'Turbulence X
Alias US2_wind(9) = US66m_P46'Turbulence Y
Alias US2_wind(10)= US66m_P47'Turbulence Z
Units US66m_P8 = ms-1
Units US66m_P9 = ms-1
Units US66m_P10= ms-1
Units US66m_P11= ms-1
Units US66m_P12= ms-1
Units US66m_P13= Deg
Units US66m_P14= Deg
Units US66m_P45= ms-1
Units US66m_P46= ms-1
Units US66m_P47= ms-1
'--------------------------------------------------------
'------------------------------------------------------
'Wind Array of Ultrasonic #1 Telegram 7 (29 Meters)
Public US1T7_wind(10) As Float
Alias US1T7_wind(1) = UST7_29m_P8 'Wind Velocity X Component
Alias US1T7_wind(2) = UST7_29m_P9 'Wind Velocity Y Component
Alias US1T7_wind(3) = UST7_29m_P10'Wind Velocity Z Compoent
Alias US1T7_wind(4) = UST7_29m_P17'Acoustic Virtual Temperature
Alias US1T7_wind(5) = UST7_29m_P22'Std X Component
Alias US1T7_wind(6) = UST7_29m_P23'Std Y Component
Alias US1T7_wind(7) = UST7_29m_P24'Std Z Component
Alias US1T7_wind(8) = UST7_29m_P31'Std Acoustic Virtual Temperature
Alias US1T7_wind(9) = UST7_29m_P58'Thies Status
Alias US1T7_wind(10)= UST7_29m_P67'Check sum hexadecimal
Units UST7_29m_P8 = ms-1
Units UST7_29m_P9 = ms-1
Units UST7_29m_P10= ms-1
Units UST7_29m_P17= DegC
Units UST7_29m_P22= ms-1
Units UST7_29m_P23= ms-1
Units UST7_29m_P24= ms-1
Units UST7_29m_P31= DegC
'--------------------------------------------------------
'------------------------------------------------------
'Wind Array of Ultrasonic #2 Telegram 7 (66 Meters)
Public US2T7_wind(10) As Float
Alias US2T7_wind(1) = UST7_66m_P8'Wind Velocity X Component
Alias US2T7_wind(2) = UST7_66m_P9'Wind Velocity Y Component
Alias US2T7_wind(3) = UST7_66m_P10'Wind Velocity Z Component
Alias US2T7_wind(4) = UST7_66m_P17'Acoustic Virtual Temperature
Alias US2T7_wind(5) = UST7_66m_P22'Std. X component
Alias US2T7_wind(6) = UST7_66m_P23'Std. Y Component
Alias US2T7_wind(7) = UST7_66m_P24'Std. Z component
Alias US2T7_wind(8) = UST7_66m_P31'Std. Acoustic Virtuall Temperature
Alias US2T7_wind(9) = UST7_66m_P58'Thies Status
Alias US2T7_wind(10)= UST7_66m_P67'Check Sum
Units UST7_66m_P8 = ms-1
Units UST7_66m_P9 = ms-1
Units UST7_66m_P10= ms-1
Units UST7_66m_P17= DegC
Units UST7_66m_P22= ms-1
Units UST7_66m_P23= ms-1
Units UST7_66m_P24= ms-1
Units UST7_66m_P31= DegC
'--------------------------------------------------------
'-------------------------------------------------------
Public US1Telegram6B
Public US2Telegram6B
Public in_US1Telegram6_1 As String * 80
Public in_US1Telegram6_2 As String * 80
Public in_US2Telegram6_1 As String * 80
Public in_US2Telegram6_2 As String * 80
'--------------------------------------------------------
'-------------------------------------------------------
Public US1Telegram7B
Public US2Telegram7B
Public in_US1Telegram7_1 As String * 80
Public in_US1Telegram7_2 As String * 80
Public in_US2Telegram7_1 As String * 80
Public in_US2Telegram7_2 As String * 80
Public TelegramRequest6 As String
Public TelegramRequest7 As String
'--------------------------------------------------------
'Modbus
Dim t1 (5) As Float, t2 (5) As Float, t3 (5) As Float, t4 (5) As Float, t5 (5) As Float, t6 (5) As Float
Dim Temp (6) As String
Public Modbus (70) As Float
Public Variable (70) As Boolean
Public Time (9) As Float
'-------------------------------------------------------------
'Define Data Tables
'-------------------------------------------------------------
'15 Seconds Battery and Panel Temperature Table
DataTable (Health,1,1000)
DataInterval (0,1,Hr,10)
Minimum (1,BatteryVoltage,FP2,0,False)
Sample (1,Panel_Temp,FP2)
EndTable
'10 Minutes Table
DataTable(Ten,True,-1)
DataInterval(0,10,Min,10)
Average(1,BarometricPressure_10m,FP2,False)
FieldNames ("BP_10m")
Average(1,AirTemperature_10m,FP2,False)
FieldNames ("TC_10_AVG")
Sample(1,RH_10m,FP2)
FieldNames("RH_10")
Average(1,US29m_P8,FP2,False)
FieldNames ("X_29_AVG")
Average(1,US29m_P9,FP2,False)
FieldNames("Y_29_AVG")
Average(1,US29m_P10,FP2,False)
FieldNames ("Z_29_AVG")
Average(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_AVG")
StdDev(1,US29m_P8,FP2,False)
FieldNames ("X_29_Std")
StdDev(1,US29m_P9,FP2,False)
FieldNames("Y_29_Std")
StdDev(1,US29m_P10,FP2,False)
FieldNames ("Z_29_Std")
StdDev(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_Std")
Average(1,US29m_P45,FP2,False)
FieldNames ("TurbX_29_AVG")
Average(1,US29m_P46,FP2,False)
FieldNames("TurbY_29_AVG")
Average(1,US29m_P47,FP2,False)
FieldNames ("TurbZ_29_AVG")
Average(1,US29m_P11,FP2,False)
FieldNames ("Wv_29_AVG")
Average(1,US29m_P12,FP2,False)
FieldNames ("WvAzi_29_AVG")
Average(1,US29m_P13,FP2,False)
FieldNames ("WdAzi_29_Smpl")
Average(1,US29m_P14,FP2,False)
FieldNames ("WdElv_29_Smpl")
Average(1,WS_31m,FP2,False)
FieldNames ("WS_31_AVG")
Maximum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Max")
Minimum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Min")
StdDev(1,WS_31m,FP2,False)
FieldNames ("WS_31_Std")
Totalize(1,WindRun_31m,FP2,False)
FieldNames("WR_31_Ttl")
Sample(1,WD_31m,FP2)
FieldNames ("WindDir_31_Smpl")
StdDev(1,WD_31m,FP2,False)
FieldNames ("WindDir_31_Std")
Average(1,US66m_P8,FP2,False)
FieldNames ("X_66_AVG")
Average(1,US66m_P9,FP2,False)
FieldNames("Y_66_AVG")
Average(1,US66m_P10,FP2,False)
FieldNames ("Z_66_AVG")
Average(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_AVG")
StdDev(1,UST7_66m_P8,FP2,False)
FieldNames ("X_66_Std")
StdDev(1,UST7_66m_P9,FP2,False)
FieldNames("Y_66_Std")
StdDev(1,UST7_66m_P10,FP2,False)
FieldNames ("Z_66_Std")
StdDev(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_Std")
Average(1,US66m_P45,FP2,False)
FieldNames ("TurbX_66_AVG")
Average(1,US66m_P46,FP2,False)
FieldNames("TurbY_66_AVG")
Average(1,US66m_P47,FP2,False)
FieldNames ("TurbZ_66_AVG")
Average(1,US66m_P11,FP2,False)
FieldNames ("Wv_66_AVG")
Average(1,US66m_P12,FP2,False)
FieldNames ("WvAzi_66_AVG")
Average(1,US66m_P13,FP2,False)
FieldNames ("WdAzi_66_Smpl")
Average(1,US66m_P14,FP2,False)
FieldNames ("WdElv_66_Smpl")
Average(1,AirTemperature_68m,FP2,False)
FieldNames ("TC_68_AVG")
Sample(1,RH_68m,FP2)
FieldNames("RH_68")
Average(1,WS_68m,FP2,False)
FieldNames ("WS_68_AVG")
Maximum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Max")
Minimum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Min")
StdDev(1,WS_68m,FP2,False)
FieldNames ("WS_68_Std")
Totalize(1,WindRun_68m,FP2,False)
FieldNames("WR_68_Ttl")
Sample(1,WD_68m,FP2)
FieldNames ("WindDir_68_Smpl")
StdDev(1,WD_68m,FP2,False)
FieldNames ("WindDir_68_Std")
Average(1,WS_70m,FP2,False)
FieldNames ("WS_70_AVG")
Maximum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Max")
Minimum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Min")
StdDev(1,WS_70m,FP2,False)
FieldNames ("WS_70_Std")
Totalize(1,WindRun_70m,FP2,False)
FieldNames("WR_70_Ttl")
EndTable
'Hourly Data Table
DataTable(Hourly,True,-1)
DataInterval(0,60,Min,10)
Average(1,BarometricPressure_10m,FP2,False)
FieldNames ("BP_10m")
Average(1,AirTemperature_10m,FP2,False)
FieldNames ("TC_10_AVG")
Sample(1,RH_10m,FP2)
FieldNames("RH_10")
Average(1,US29m_P8,FP2,False)
FieldNames ("X_29_AVG")
Average(1,US29m_P9,FP2,False)
FieldNames("Y_29_AVG")
Average(1,US29m_P10,FP2,False)
FieldNames ("Z_29_AVG")
Average(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_AVG")
StdDev(1,US29m_P8,FP2,False)
FieldNames ("X_29_Std")
StdDev(1,US29m_P9,FP2,False)
FieldNames("Y_29_Std")
StdDev(1,US29m_P10,FP2,False)
FieldNames ("Z_29_Std")
StdDev(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_Std")
Average(1,US29m_P45,FP2,False)
FieldNames ("TurbX_29_AVG")
Average(1,US29m_P46,FP2,False)
FieldNames("TurbY_29_AVG")
Average(1,US29m_P47,FP2,False)
FieldNames ("TurbZ_29_AVG")
Average(1,US29m_P11,FP2,False)
FieldNames ("Wv_29_AVG")
Average(1,US29m_P12,FP2,False)
FieldNames ("WvAzi_29_AVG")
Average(1,US29m_P13,FP2,False)
FieldNames ("WdAzi_29_Smpl")
Average(1,US29m_P14,FP2,False)
FieldNames ("WdElv_29_Smpl")
Average(1,WS_31m,FP2,False)
FieldNames ("WS_31_AVG")
Maximum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Max")
Minimum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Min")
StdDev(1,WS_31m,FP2,False)
FieldNames ("WS_31_Std")
Totalize(1,WindRun_31m,FP2,False)
FieldNames("WR_31_Ttl")
Sample(1,WD_31m,FP2)
FieldNames ("WindDir_31_Smpl")
StdDev(1,WD_31m,FP2,False)
FieldNames ("WindDir_31_Std")
Average(1,US66m_P8,FP2,False)
FieldNames ("X_66_AVG")
Average(1,US66m_P9,FP2,False)
FieldNames("Y_66_AVG")
Average(1,US66m_P10,FP2,False)
FieldNames ("Z_66_AVG")
Average(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_AVG")
StdDev(1,UST7_66m_P8,FP2,False)
FieldNames ("X_66_Std")
StdDev(1,UST7_66m_P9,FP2,False)
FieldNames("Y_66_Std")
StdDev(1,UST7_66m_P10,FP2,False)
FieldNames ("Z_66_Std")
StdDev(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_Std")
Average(1,US66m_P45,FP2,False)
FieldNames ("TurbX_66_AVG")
Average(1,US66m_P46,FP2,False)
FieldNames("TurbY_66_AVG")
Average(1,US66m_P47,FP2,False)
FieldNames ("TurbZ_66_AVG")
Average(1,US66m_P11,FP2,False)
FieldNames ("Wv_66_AVG")
Average(1,US66m_P12,FP2,False)
FieldNames ("WvAzi_66_AVG")
Average(1,US66m_P13,FP2,False)
FieldNames ("WdAzi_66_Smpl")
Average(1,US66m_P14,FP2,False)
FieldNames ("WdElv_66_Smpl")
Average(1,AirTemperature_68m,FP2,False)
FieldNames ("TC_68_AVG")
Sample(1,RH_68m,FP2)
FieldNames("RH_68")
Average(1,WS_68m,FP2,False)
FieldNames ("WS_68_AVG")
Maximum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Max")
Minimum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Min")
StdDev(1,WS_68m,FP2,False)
FieldNames ("WS_68_Std")
Totalize(1,WindRun_68m,FP2,False)
FieldNames("WR_68_Ttl")
Sample(1,WD_68m,FP2)
FieldNames ("WindDir_68_Smpl")
StdDev(1,WD_68m,FP2,False)
FieldNames ("WindDir_68_Std")
Average(1,WS_70m,FP2,False)
FieldNames ("WS_70_AVG")
Maximum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Max")
Minimum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Min")
StdDev(1,WS_70m,FP2,False)
FieldNames ("WS_70_Std")
Totalize(1,WindRun_70m,FP2,False)
FieldNames("WR_70_Ttl")
EndTable
DataTable(Daily,True,-1)
DataInterval(0,1440,Min,10)
Average(1,BarometricPressure_10m,FP2,False)
FieldNames ("BP_10m")
Average(1,AirTemperature_10m,FP2,False)
FieldNames ("TC_10_AVG")
Sample(1,RH_10m,FP2)
FieldNames("RH_10")
Average(1,US29m_P8,FP2,False)
FieldNames ("X_29_AVG")
Average(1,US29m_P9,FP2,False)
FieldNames("Y_29_AVG")
Average(1,US29m_P10,FP2,False)
FieldNames ("Z_29_AVG")
Average(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_AVG")
StdDev(1,US29m_P8,FP2,False)
FieldNames ("X_29_Std")
StdDev(1,US29m_P9,FP2,False)
FieldNames("Y_29_Std")
StdDev(1,US29m_P10,FP2,False)
FieldNames ("Z_29_Std")
StdDev(1,UST7_29m_P17,FP2,False)
FieldNames ("SonicTC_29_Std")
Average(1,US29m_P45,FP2,False)
FieldNames ("TurbX_29_AVG")
Average(1,US29m_P46,FP2,False)
FieldNames("TurbY_29_AVG")
Average(1,US29m_P47,FP2,False)
FieldNames ("TurbZ_29_AVG")
Average(1,US29m_P11,FP2,False)
FieldNames ("Wv_29_AVG")
Average(1,US29m_P12,FP2,False)
FieldNames ("WvAzi_29_AVG")
Average(1,US29m_P13,FP2,False)
FieldNames ("WdAzi_29_Smpl")
Average(1,US29m_P14,FP2,False)
FieldNames ("WdElv_29_Smpl")
Average(1,WS_31m,FP2,False)
FieldNames ("WS_31_AVG")
Maximum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Max")
Minimum(1,WS_31m,FP2,False,False)
FieldNames ("WS_31_Min")
StdDev(1,WS_31m,FP2,False)
FieldNames ("WS_31_Std")
Totalize(1,WindRun_31m,FP2,False)
FieldNames("WR_31_Ttl")
Sample(1,WD_31m,FP2)
FieldNames ("WindDir_31_Smpl")
StdDev(1,WD_31m,FP2,False)
FieldNames ("WindDir_31_Std")
Average(1,US66m_P8,FP2,False)
FieldNames ("X_66_AVG")
Average(1,US66m_P9,FP2,False)
FieldNames("Y_66_AVG")
Average(1,US66m_P10,FP2,False)
FieldNames ("Z_66_AVG")
Average(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_AVG")
StdDev(1,UST7_66m_P8,FP2,False)
FieldNames ("X_66_Std")
StdDev(1,UST7_66m_P9,FP2,False)
FieldNames("Y_66_Std")
StdDev(1,UST7_66m_P10,FP2,False)
FieldNames ("Z_66_Std")
StdDev(1,UST7_66m_P17,FP2,False)
FieldNames ("SonicTC_66_Std")
Average(1,US66m_P45,FP2,False)
FieldNames ("TurbX_66_AVG")
Average(1,US66m_P46,FP2,False)
FieldNames("TurbY_66_AVG")
Average(1,US66m_P47,FP2,False)
FieldNames ("TurbZ_66_AVG")
Average(1,US66m_P11,FP2,False)
FieldNames ("Wv_66_AVG")
Average(1,US66m_P12,FP2,False)
FieldNames ("WvAzi_66_AVG")
Average(1,US66m_P13,FP2,False)
FieldNames ("WdAzi_66_Smpl")
Average(1,US66m_P14,FP2,False)
FieldNames ("WdElv_66_Smpl")
Average(1,AirTemperature_68m,FP2,False)
FieldNames ("TC_68_AVG")
Sample(1,RH_68m,FP2)
FieldNames("RH_68")
Average(1,WS_68m,FP2,False)
FieldNames ("WS_68_AVG")
Maximum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Max")
Minimum(1,WS_68m,FP2,False,False)
FieldNames ("WS_68_Min")
StdDev(1,WS_68m,FP2,False)
FieldNames ("WS_68_Std")
Totalize(1,WindRun_68m,FP2,False)
FieldNames("WR_68_Ttl")
Sample(1,WD_68m,FP2)
FieldNames ("WindDir_68_Smpl")
StdDev(1,WD_68m,FP2,False)
FieldNames ("WindDir_68_Std")
Average(1,WS_70m,FP2,False)
FieldNames ("WS_70_AVG")
Maximum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Max")
Minimum(1,WS_70m,FP2,False,False)
FieldNames ("WS_70_Min")
StdDev(1,WS_70m,FP2,False)
FieldNames ("WS_70_Std")
Totalize(1,WindRun_70m,FP2,False)
FieldNames("WR_70_Ttl")
EndTable
'----------------------------------------------------
'Main Program
'----------------------------------------------------
BeginProg
SequentialMode
'----------------------------------------------------
'Configure ModBus Slave
'ModBusSlave ( ComPort, BaudRate, ModBusAddr, ModBusVariable, BooleanVariable, Modbus Option)
ModbusSlave (502,115200,1,Modbus(),Variable(),0)
SerialOpen (Com2,9600,0,0,200) 'Open Com2 (C3,C4) to receive data from Ultrasonic Anemometer#1
SerialOpen (Com3,9600,0,0,200) 'Open Com3 (C5,C6) to receive data from Ultrasonic Anemometer#2
TelegramRequest6= "00TR6"+CHR(13)+CHR(10)
TelegramRequest7= "00TR7"+CHR(13)+CHR(10)
'----------------------------------------------------
Scan (10,Sec,0,0)
'-------------------------------------------------
'ULTRASONIC 1 Telegram 6
SerialOut (Com2,TelegramRequest6,"",0,0) 'Send Telegram #6 request
Delay(2,10,msec)
SerialInRecord (Com2,in_US1Telegram7_1,0,0,0,US1Telegram7B,01)'Record in String
Delay(2,10,msec)
in_US1Telegram7_2 = Trim (in_US1Telegram7_1)'Trim String
SplitStr (US1T7_wind(1),in_US1Telegram7_2,";",10,0)'Split and Store Paramters in Wind Array
'ULTRASONIC2 Telegram 6
SerialOut (Com3,TelegramRequest6,"",0,0) 'Send Telegram #6 request
Delay(2,10,msec)
SerialInRecord (Com3,in_US2Telegram7_1,0,0,0,US2Telegram7B,01)'Record in String
Delay(2,10,msec)
in_US2Telegram7_2 = Trim (in_US2Telegram7_1)'Trim String
SplitStr (US2T7_wind(1),in_US2Telegram7_2,";",10,0)'Split and Store Paramters in Wind Array
'ULTRASONIC 1 Telegram 7
SerialOut (Com2,TelegramRequest7,"",0,0) 'Send Telegram #6 request
Delay(2,10,msec)
SerialInRecord (Com2,in_US1Telegram6_1,0,0,0,US1Telegram6B,01)'Record in String
Delay(2,10,msec)
in_US1Telegram6_2 = Trim (in_US1Telegram6_1)'Trim String
SplitStr (US1_wind(1),in_US1Telegram6_2,";",10,0)'Split and Store Paramters in Wind Array
'SerialFlush (Com2)
'SerialFlush (Com3)
'ULTRASONIC2 Telegram 7
SerialOut (Com3,TelegramRequest7,"",0,0) 'Send Telegram #6 request
Delay(2,10,msec)
SerialInRecord (Com3,in_US2Telegram6_1,0,0,0,US2Telegram6B,01)'Record in String
Delay(2,10,msec)
in_US2Telegram6_2 = Trim (in_US2Telegram6_1)'Trim String
SplitStr (US2_wind(1),in_US2Telegram6_2,";",10,0)'Split and Store Paramters in Wind Array
'--------------------------------------------------------------------------------------------------------
'-------------------------------------------------
' --------------------------------------------------
'Panel Temperature and Battery Voltage
PanelTemp (Panel_Temp,250)
Battery (BatteryVoltage)
RealTime (Time())
'------------------------------------------------------
'Measuring Cup Anemometers
'Serial Number = 12137291 -- 31 Meters
PulseCount (WS_31m,1,1,0,1,0.04602,0.2348)
If WS_31m <= 0.2348 Then WS_31m = 0
'Serial Number = 12137289 -- 68 Meters
PulseCount (WS_68m,1,2,0,1,0.04582,0.2779)
If WS_68m <= 0.2780 Then WS_68m = 0
'Serial Number = 12137294 -- 70 Meters
PulseCount (WS_70m,1,11,0,1,0.04583,0.2780)
If WS_70m <= 0.2780 Then WS_70m = 0
'--------------------------------------------------------
'Measuring Hygro Thermo transmitters
' 10 Meters
VoltSe(AirTemperature_10m,1,mV2500,1,0,0,_60Hz,0.1,-30)
VoltSe(RH_10m,1,mv5000,2,0,0,_60Hz,0.1,0)
If RH_10m>100 AND RH_10m<108 Then RH_10m=100
'68 Meters
VoltSe(AirTemperature_68m,1,mv5000,3,0,0,_60Hz,0.1,-30)
VoltSe(RH_68m,1,mv5000,4,0,0,_60Hz,0.1,0)
If RH_10m>100 AND RH_10m<108 Then RH_10m=100
'---------------------------------------------------------
'Measuring Barometer -- 10 Meters
VoltSe(BarometricPressure_10m,1,mv5000,5,1,0,_60Hz,0.052,800)
'BarometricPressure_10m =BarometricPressure_10m*0.75006
'---------------------------------------------------------
'Measuring Wind Direction Transmitters
'31 Meters
BrHalf(WD_31m,1,mV2500,6,1,1,2500,True,0,_60Hz,360,0)
If WD_31m>=360 Then WD_31m=0
'68 Meters
BrHalf(WD_68m,1,mV2500,7,2,1,2500,True,0,_60Hz,360,0)
If WD_68m>=360 Then WD_68m=0
'--------------------------------------------------------
' Measuring US 3D Anemometer
'-------------------------------------------------------
'Calculating Wind Run
WindRun_68m =WS_68m *30
WindRun_70m = WS_70m *30
'-------------------------------------------------------
'----------------------------------------------------------
'Modbus Variable Array
If Ten.Output Then
Modbus (1) = public.time(1) '40001
Modbus (2) = public.time(2) '40003
Modbus (3) = public.time(3) '40005
Modbus (4) = Public.time(4) '40007
Modbus (5) = public.time(5) '40009
Modbus (6) = public.time(6) '40011
Modbus (7) = status.RevBoard '40013
Modbus (8) = public.BatteryVoltage '40015
Modbus (9) = public.Panel_Temp '40017
Modbus (10)=status.SkippedScan '40019
Modbus (11)=status.Low12VCount '40021
Modbus (12)=status.WatchDOgErrors '40023
Modbus (13)=status.ProgErrors '40025
Modbus (14)= Ten.BP_10m '40027
Modbus (15)= Ten.TC_10_AVG '40029
Modbus (16)= Ten.RH_10 '40031
Modbus (17)= Ten.X_29_AVG '40033
Modbus (18)= Ten.Y_29_AVG '40035
Modbus (19)= Ten.Z_29_AVG '40037
Modbus (20)= Ten.SonicTC_29_AVG '40039
Modbus (21)= Ten.X_29_Std '40041
Modbus (22)= Ten.Y_29_Std '40043
Modbus (23)= Ten.Z_29_Std '40045
Modbus (24)= Ten.SonicTC_29_Std '40047
Modbus (25)= Ten.TurbX_29_AVG '40049
Modbus (26)= Ten.TurbY_29_AVG '40051
Modbus (27)= Ten.TurbZ_29_AVG '40053
Modbus (28)= Ten.Wv_29_AVG '40055
Modbus (29)= Ten.WvAzi_29_AVG '40057
Modbus (30)= Ten.WdAzi_29_Smpl '40059
Modbus (31)= Ten.WdElv_29_Smpl '40061
Modbus (32)= Ten.WS_31_AVG '40063
Modbus (33)= Ten.WS_31_Max '40065
Modbus (34)= Ten.WS_31_Min '40067
Modbus (35)= Ten.WS_31_Std '40069
Modbus (36)= Ten.WR_31_Ttl '40071
Modbus (37)= Ten.WindDir_31_Smpl '40073
Modbus (38)= Ten.WindDir_31_Std '40075
Modbus (39)= Ten.X_66_AVG '40077
Modbus (40)= Ten.Y_66_AVG '40079
Modbus (41)= Ten.Z_66_AVG '40081
Modbus (42)= Ten.SonicTC_66_AVG '40083
Modbus (43)= Ten.X_66_Std '40085
Modbus (44)= Ten.Y_66_Std '40087
Modbus (45)= Ten.Z_66_Std '40089
Modbus (46)= Ten.SonicTC_66_Std '40091
Modbus (47)= Ten.TurbX_66_AVG '40093
Modbus (48)= Ten.TurbY_66_AVG '40095
Modbus (49)= Ten.TurbZ_66_AVG '40097
Modbus (50)= Ten.Wv_66_AVG '40099
Modbus (51)= Ten.WvAzi_66_AVG '40101
Modbus (52)= Ten.WdAzi_66_Smpl '40103
Modbus (53)= Ten.WdElv_66_Smpl '40105
Modbus (54)= Ten.TC_68_AVG '40107
Modbus (55)= Ten.RH_68 '40109
Modbus (56)= Ten.WS_68_AVG '40111
Modbus (57)= Ten.WS_68_Max '40113
Modbus (58)= Ten.WS_68_Min '40115
Modbus (59)= Ten.WS_68_Std '40117
Modbus (60)= Ten.WR_68_Ttl '40119
Modbus (61)= Ten.WindDir_68_Smpl '40121
Modbus (62)= Ten.WindDir_68_Std '40123
Modbus (63)= Ten.WS_70_AVG '40125
Modbus (64)= Ten.WS_70_Max '40127
Modbus (65)= Ten.WS_70_Min '40129
Modbus (66)= Ten.WS_70_Std '40131
Modbus (67)= Ten.WR_70_Ttl '40133
EndIf
'------------------------------------------------------
'Call Data Tables
CallTable Health
CallTable Ten
CallTable Daily
CallTable Hourly
NextScan
EndProg
Just a quick observation.. Your scan rate must be 1 sec if you are planning on getting a modbus sample every second, otherwise you will get the same result 10 times in a row. Also, it is unlikely that you can get modbus to work that fast unless you are only polling a minimal number of samples, of course that is my experience.