This program can be modified for your own application[s]. It is provided to give you a starting point for your own project. If you can figure out my code, that is...Good Luck. 1 if mem(14)>0 then goto 5 2 mem(1)=time mod 86400:mem(14)=15:mem(13)=1:gosub 95 3 power 0:pulse 1,0:pulse 5,0:a=0:b=0:c=0:d=0:e=0:f=0:g=0:h=0:i=0:j=0:k=0:l=0:m=0:n=0:o=0:p=0:q=0:r=0:s=0:t=0:u=0:v=0:w=0:x=0:y=0:z=0:power 1:gosub 94 4 mem(12)=mem(5):mem(11)=mem(3):GoSub 90 5 mem(9)=int(time mod 86400/60):pulse- 1,0:power 1:if int(mem(9))=mem(10) then goto 80 6 mem(10)=mem(9):Mem(3)=Int(Time Mod 86400/3600):Mem(2)=Int(Time Mod 3600/60):Open "COM:":Control 11,9600:Control 1:? 0$;:Close 7 if mem(2)=0 or mem(2)=15 or mem(2)=30 or mem(2)=45 then d=0:g=0:j=0:m=0:p=0:s=0:w=0:#QQ=0:#DQ=0:#AQ=0 8 If mem(3)=0 and mem(2)=5 Then pulse 5,.5 9 If mem(3)=0 and mem(2)=35 Then power 0:sleep .5:power 1:sleep 2:GoSub 90 10 if mem(2)>0 then goto 80 11 #AD=#AD+#AH:Open "COM:":Control 11,9600:Control 1 12 ? " ";Mem(11)%2z;":00-";Mem(11)%2z;":59",#QH!3!2,#DH!3!2,#AH!3!2,#AD!4!2 13 mem(11)=mem(3):e=0:h=0:k=0:n=0:q=0:t=0:x=0:z=0:#QH=0:#DH=0:#AH=0 14 if mem(3)>0 then goto 80 20 ?:? " ---------------------------------------------------------------------":? 23 ? " Average[s] and Grand Total[s] at ";&u;" for "; 24 If Mem(8)=0 Then ? "Monday "; 25 If Mem(8)=1 Then ? "Tuesday "; 26 If Mem(8)=2 Then ? "Wednesday "; 27 If Mem(8)=3 Then ? "Thursday "; 28 If Mem(8)=4 Then ? "Friday "; 29 If Mem(8)=5 Then ? "Saturday "; 30 If Mem(8)=6 Then ? "Sunday "; 31 ? Mem(5)!2!0;"-";Mem(4)!2!0;"-";Mem(6)!4!0:? 32 ? " Average Q = ";#QD!4!2;" CFS":? " Average Depth = ";#DD!4!2;" Ft":? " Total Flow = ";#AD!6!1;" AcFt":Close 33 mem(15)=mem(15)+#QD:mem(16)=mem(16)+#AD:mem(17)=mem(17)+#DD:mem(13)=mem(13)+1:f=0:i=0:l=0:r=0:u=0:y=0:#QD=0:#DD=0:#AD=0:gosub 95 34 if mem(5)=mem(12) then goto 70 40 mem(13)=mem(13)-1 41 Open "COM:":Control 11,9600:Control 1:? 12$:?:?:? " *********** ";&u;" Water Accounting Monthly Totals **********":?:?:?:?:? 42 ? " Average[s] and Grand Total at ";&u;" for "; 43 If mem(12)=1 Then ? "January ";mem(6)!4!0 44 If mem(12)=2 Then ? "February ";mem(6)!4!0 45 If mem(12)=3 Then ? "March ";mem(6)!4!0 46 If mem(12)=4 Then ? "April ";mem(6)!4!0 47 If mem(12)=5 Then ? "May ";mem(6)!4!0 48 If mem(12)=6 Then ? "June ";mem(6)!4!0 49 If mem(12)=7 Then ? "July ";mem(6)!4!0 50 If mem(12)=8 Then ? "August ";mem(6)!4!0 51 If mem(12)=9 Then ? "September ";mem(6)!4!0 52 If mem(12)=10 Then ? "October ";mem(6)!4!0 53 If mem(12)=11 Then ? "November ";mem(6)!4!0 54 If mem(12)=12 Then ? "December ";mem(6)-1!4!0 55 ?:? " Number of Days this Month = ";mem(13)!2!0;" Days." 56 ? " Number of Samples in Report = ";mem(13)*o!6!0;" Samples. [";o!4!0;" per day]" 57 ? " Monthly Average Flow = ";mem(15)/mem(13)!3!2;" CFS." 58 ? " Monthly Average Depth = ";mem(17)/mem(13)!3!2;" Feet." 60 ? " Total Acre Feet Measured = ";mem(16)!7!2;" AcFt." 61 ?:? " ------------------end of monthly totals --------------------":? 12$:close 62 mem(12)=mem(5):mem(15)=0:mem(16)=0:mem(17)=0:mem(13)=1 70 o=0 80 a=0:b=0:for c=1 to 13:a=a+measure(Q):b=b+measure(DEPTH):next c 81 c=c-1:a=a/c:b=b/c 82 If a<0.3 Then a=0.01 83 If b<0 Then b=0.01 84 #QI=a:#DI=b:#AI=#QI*3600/43560:w=w+1:x=x+1:y=y+1:d=d+#QI:e=e+#QI:f=f+#QI:j=j+#DI:k=k+#DI:l=l+#DI:g=g+#AI:h=h+#AI:i=i+#AI:#QQ=d/w:#QH=e/x:#QD=f/y:#DQ=j/w:#DH=k/x:#DD=l/y:#AQ=g/w:#AH=h/x:#AD=#AD+(#QI*20/43560):pulse 1,0:Stop 90 Open "COM:":Control 11,9600:Control 1:? 12$:?:?:? " ** ";&u;" Water Accounting Daily Totals **":? 91 ? " Time_Frame Flow Depth AcFt/H AcFt/T " 92 ? " ----------- ------ ------ ------ ------ ":?:Close:Return 94 Mem(3)=Int(Time Mod 86400/3600):Mem(2)=Int(Time Mod 3600/60):return 95 mem(7)=Date(Time):mem(6)=Int(mem(7)/10000):mem(5)=Int((mem(7)-mem(6)*10000)/100):mem(4)=mem(7)-(mem(6)*10000+mem(5)*100):Mem(8)=Int(Time Mod 604800/86400):return 96 mem(1)=time mod 86400:? 9$;9$;&u;9$;"Time: ";int(mem(1)/3600)!2!0;58$;int(mem(1) mod 3600/60)!2!0;58$;int(mem(1) mod 60)!2!0;9$;"Date: ";mem(4)!2!0;"-";mem(5)!2!0;"-";mem(6)!4!0:return 100 ' -------------- 100 ' Internet Reporting Tiny-BASIC Program. Dave Gunderson E-Mail: Dave@DesertFoxx.com 100 ' This program collects data from sensors every 20 seconds, then computes running averages for 100 ' 15 min (45 samples) in '#_Q' variables, hourly averages in '#_H' variables (180 samples). 100 ' Each variable type has a purpose. The Raw reading - Q, Depth - is used locally. 100 ' The Instant Average - #QI, #DI, - computes a 'smoothed' reading for setting Flow & Depth 100 ' values [maintenance use only]. The values are also used to smooth out the 'wave action' seen 100 ' mainly in the Canal readings. The Quarterly Average - #QQ, #DQ, etc - is computed as a 100 ' running average and is logged in the 8210. The Hourly Average - #QH, #DH, etc - is computed 100 ' at 59 minutes after the hour is used by the Report. Whenever Tiny-BASIC is active an LED 100 ' (Red) lights, the (Green) LED lights when sensor readings are taken.At 00:05:00 the 8210 will 100 ' trigger the ICADDY to send the EMail. The ICADDY will attempt to send EMail until it is 100 ' successful. If it is not - it keeps dialing... In the event of an EMail failure the Cell Phone 100 ' charges can be STEEP! For this worst-case scenerio the ICADDY and MODEM are powered off [to 100 ' Master Clear them and clear the condition]. This Master Clear sequence happens nightly at 100 ' 00:35:00 even if there were no failures. The EMail sent at 00:05:00 contains the hourly 100 ' information and the previous Day's totals. At the end of the Month, an additional Report is 100 ' generated giving the monthly totals. Sweet. 100 ' -------------------------------------------------------------------------------------------- 100 ' VARIABLE[s] - PSEUDO SENSOR[s] - MEM(VAR) USAGE: 100 ' -------------------------------------------------------------------------------------------- 100 ' A = Q [Flow] Sensor | T = [Hr ] | mem(1) = seconds from midnight 100 ' B = Depth Sensor | U = [Day] | mem(2) = min 100 ' C = | V = Variable | mem(3) = hrs 100 ' D = Q Acc [Qtr] | W = Cycle Cnt [Qtr] | mem(4) = day 100 ' E = Q Acc [Hr ] | X = Cycle Cnt [Hr ] | mem(5) = mon 100 ' F = Q Acc [Day] | Y = Cycle Cnt [Day] | mem(6) = yrs 100 ' G = AcFt [Qtr] | Z = Variable | mem(7) = yyyymmdd 100 ' H = AcFt [Hr ] | #QI = Flow Avg [Ins] | mem(8) = day of week 100 ' I = AcFt [Day] | #DI = Depth Avg [Ins] | mem(9) = minutes from midnight 100 ' J = Depth [Qtr] | #AI = AcFt Avg [Ins] | mem(10) = minute flag 100 ' K = Depth [Hr ] | #QQ = Flow Avg [Qtr] | mem(11) = hour flag 100 ' L = Depth [Day] | #DQ = Depth Avg [Qtr] | mem(12) = month flag 100 ' M = [Qtr] | #AQ = AcFt Avg [Qtr] | mem(13) = day of month [counter] 100 ' N = [Hr ] | #QH = Flow Avg [Hr ] | mem(14) = Time Multiple 100 ' O = [Day] | #DH = Depth Avg [Hr ] | mem(15) = Monthly Flow CFS totals 100 ' P = [Qtr] | #AH = AcFt Avg [Hr ] | mem(16) = Monthly Acre Feet totals 100 ' Q = [Hr ] | #QD = Flow Avg [Day] | mem(17) = Monthly Avg Depth 100 ' R = [Day] | #DD = Depth Avg [Day] | mem(18) = 100 ' S = [Qtr] | #AD = AcFt Tot [Day] | mem(19) = 100 ' ------------subroutines-------------------------outputs------------|--------sensors---------------- 100 ' 90 = print report header [call] | Output1: BASIC Active LED | 100 ' 94 = calc min hrs [call] | Output5: Trigger to ICADDY | Q = Flow 4-20ma 100 ' 95 = calc mon day year dow [call] | Aux Power:ICADDY&Modem +12V | DEPTH = Depth 4-20ma 100 ' 96 = print unit id time & date [call]| +5VDC: Sensor Read LED | 100 ' --------------------------------------------------------------------------------------------------- 100 ' MAIN SETUP | EEROM SETUP | GOES SETUP [optional] 100 ' EPROM Version: V40 | Serial Port Mode: USER | Transmit Mode: TIMED 100 ' Unit ID: RemoteSite | User Baud Rate: 9600 | Satellite ID: XXXXXXXX 100 ' Measurement Interval: 00:15:00 | Radio Baud Rate: 1200 | Format (ST): BINARY 100 ' Sampling Interval: 00:00:30 | Com Baud Rate: 9600 | Carrier (ST): SHORT 100 ' Measurment Time: 00:14:50 | Transfer Baud Rate: 9600 | Channel (ST): 0 100 ' Sampling Time: 00:00:00 | SDI-12 Baud Rate: 1200 | TX Time (ST): 00:00:00 100 ' Switched Power Time: 00:00:00 | Enter Key Reqd: No | TX Rate (ST): 00:00:00 100 ' Samples to Average: 10 | Log Dump Mode: ALL-BIN | # Data Items/TX (ST): 0 100 ' Measurements per Log: 1 | User Time Limit: 20060 | Data Time (ST): 00:00:00 100 ' Switched Power Mode: OFF | Power Delay: 1 | Data Interval (ST): 00:00:00 100 ' Auto Record Yes | Analog Delay: 5 | International No 100 ' Basic Run Interval: 00:00:20 | Pressure Delay: 5 | Channel (RR): 0 100 ' Basic Run Time: 00:00:00 | Auto Startup Keys: | TX Normal Rate (RR): 00:00:00 100 ' Password: NukeEm | Time Format: NORMAL | TX Alarm Rate (RR): 00:00:00 100 ' Number Resets: | Date Format: DMY | # TX/Alarm (RR): 0 100 ' Log Size: 0 | Term Xmit Delay: 0 | Alarm Interval (RR): 00:00:00 100 ' ROM Checksum: 10811 | Basic Size: 5 | # Data Items/TX (RR): 0 100 ' | Amp Gain: 1.0 | Data Time (RR): 00:00:00 100 ' ------------------------------------------------------------------| Data Interval (RR): 00:00:00 100 ' MODEM SETUP | PROTOCOL SETUP |--------------------------------- 100 ' Dial-Out Enable: No | Master Name: YPO | EVENTS 100 ' Answer Mode: DATA & VOICE | Carrier Delay: 7 | Every 20 Seconds: BASIC Executes 100 ' Number of Rings: 2 | Reply Delay: 57 | OUTPUT1 Active 100 ' Phone Password: | Ack Delay: 0 | for BASIC LED 100 ' Dial-In Message: | TX Normal Rate: 00:00:00 | Every Hour 59:40 Hourly Values 100 ' @48:173:155:127r03:161:113:173: | TX Alarm Rate: 00:10:00 | sent to ICADDY 100 ' 132:127r04:113:49:46:*:,, | Retry Interval: 00:01:00 | Every Day 00:05:00 OUTPUT5 Trig 100 ' Dial-Out Message: | Number of Retries: 3 | to ICADDY for 100 ' Phone #1: | Use RS-485 w/SDI-12: No | Internet EMail 100 ' Phone #2: | Long SSP Packets: No | 00:35:00 SW POWER is 100 ' Phone #3: | H/W Handshake on COM: No | cycled to Clear 100 ' Redial Delay: 00:03:00 | Auto Dump to RAM Card: No | ICADDY & MODEM 100 ' ----------------------------------------------------------------------------------------------------- 100 ' SENSOR SETUP 100 ' Sensor #: Analog2 Analog3 100 ' Name: Q Depth #QI #DI #AI #QQ #DQ #AQ 100 ' Enable: Yes Yes Yes Yes Yes Yes Yes Yes 100 ' Measure: No No No No No No No No 100 ' Log: No No No No No Yes Yes Yes 100 ' Average: No No No No No No No No 100 ' Interval: 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 100 ' Slope: 300.0 3.75 1.0 1.0 1.0 1.0 1.0 1.0 100 ' Offset: -500.183 -3.725 0.0 0.0 0.0 0.0 0.0 0.0 100 ' Elevation: 0 0 0 0 0 0 0 0 100 ' Right Digits: 0 2 0 2 1 0 2 1 100 ' Alarm Enable: OFF OFF OFF OFF OFF OFF OFF OFF 100 ' 100 ' Name: #QH #DH #AH #QD #DD #AD Battery 100 ' Enable: Yes Yes Yes Yes Yes Yes Yes 100 ' Measure: No No No No No No No 100 ' Log: No No No No No Yes Yes 100 ' Average: No No No No No No No 100 ' Interval: 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 00:00:00 100 ' Slope: 1.0 1.0 1.0 1.0 1.0 1.0 1.0 100 ' Offset: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 100 ' Elevation: 0 0 0 0 0 0 0 100 ' Right Digits: 0 2 1 0 2 0 2 100 ' Alarm Enable: OFF OFF OFF OFF OFF OFF OFF