VERSION 2.00 Begin Form Form1 BackColor = &H00FFFFC0& Caption = "CardioMEMs, Copyright 2006" ClientHeight = 10005 ClientLeft = 255 ClientTop = 1395 ClientWidth = 14970 FillColor = &H00FFFFC0& FillStyle = 0 'Solid ForeColor = &H00000000& Height = 10515 Icon = FORM1.FRX:0000 Left = 195 LinkTopic = "Form1" ScaleHeight = 667 ScaleMode = 3 'Pixel ScaleWidth = 998 Top = 945 Width = 15090 Begin CommandButton Command9 Caption = "Notes" Height = 495 Left = 6000 TabIndex = 74 Top = 720 Width = 1215 End Begin TextBox Text23 Height = 375 Left = 3840 TabIndex = 73 Text = "Text23" Top = 9000 Width = 1335 End Begin TextBox Text22 Height = 495 Left = 4080 TabIndex = 72 Text = "Text22" Top = 3360 Width = 1215 End Begin CommandButton Command8 Caption = "Scale" Height = 375 Left = 4200 TabIndex = 71 Top = 6240 Width = 975 End Begin TextBox Text21 Height = 285 Left = 4440 TabIndex = 70 Text = "Text21" Top = 9720 Width = 855 End Begin TextBox Text20 Height = 285 Left = 4440 TabIndex = 69 Text = "Text20" Top = 2520 Width = 855 End Begin TextBox Text9 Height = 285 Left = 2760 TabIndex = 68 Text = "Text9" Top = 9720 Width = 1215 End Begin TextBox Text8 Height = 285 Left = 3960 TabIndex = 67 Text = "Text8" Top = 2280 Width = 1215 End Begin CommandButton Command2 Caption = "Calibrate" Height = 495 Left = 5880 TabIndex = 66 Top = 120 Width = 1335 End Begin CommandButton Command4 Caption = "Close" Height = 375 Left = 6000 TabIndex = 11 Top = 2160 Width = 735 End Begin FileListBox File1 Archive = 0 'False Height = 2175 Left = 7440 TabIndex = 65 Top = 120 Width = 2295 End Begin CommandButton Command7 Caption = "Recall" Height = 375 Left = 6000 TabIndex = 64 Top = 1800 Width = 735 End Begin CommandButton Command6 Caption = "Save" Height = 375 Left = 6000 TabIndex = 63 Top = 1440 Width = 735 End Begin CommandButton Command5 Caption = "Enter Gauge" Height = 375 Left = 3600 TabIndex = 62 Top = 8520 Width = 1455 End Begin TextBox Text25 BackColor = &H00FFFFFF& BorderStyle = 0 'None Height = 375 Left = 2760 TabIndex = 61 Text = "Text25" Top = 8520 Width = 735 End Begin TextBox Text24 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 3960 TabIndex = 58 Text = "Text24" Top = 8160 Width = 1215 End Begin TextBox Text19 Height = 375 Left = 4680 TabIndex = 53 Text = "Text19" Top = 1800 Width = 1215 End Begin TextBox Text18 Height = 375 Left = 4680 TabIndex = 52 Text = "Text18" Top = 1440 Width = 1215 End Begin TextBox Text17 Height = 375 Left = 4680 TabIndex = 51 Text = "Text17" Top = 1080 Width = 1215 End Begin TextBox Text15 Height = 375 Left = 4680 TabIndex = 50 Text = "Text15" Top = 720 Width = 1215 End Begin CommandButton Command3 Caption = "Calibrate_To_Mean" Height = 495 Left = 3960 TabIndex = 49 Top = 120 Width = 1815 End Begin TextBox Text16 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 255 Left = 12720 TabIndex = 48 Text = "Text16" Top = 2040 Width = 1095 End Begin TextBox Text14 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 13560 TabIndex = 43 Text = "Text14" Top = 840 Width = 855 End Begin TextBox Text13 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 13560 TabIndex = 42 Text = "Text13" Top = 360 Width = 735 End Begin TextBox Freq0 Height = 285 Index = 17 Left = 2400 TabIndex = 41 Text = "Freq0" Top = 7440 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 16 Left = 2400 TabIndex = 40 Text = "Freq0" Top = 7200 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 15 Left = 2400 TabIndex = 39 Text = "Freq0" Top = 6960 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 14 Left = 2400 TabIndex = 38 Text = "Freq0" Top = 6720 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 13 Left = 2400 TabIndex = 37 Text = "Freq0" Top = 6480 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 12 Left = 2400 TabIndex = 36 Text = "Freq0" Top = 6240 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 11 Left = 2400 TabIndex = 35 Text = "Freq0" Top = 6000 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 10 Left = 2400 TabIndex = 34 Text = "Freq0" Top = 5760 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 9 Left = 2400 TabIndex = 33 Text = "Freq0" Top = 5520 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 8 Left = 2400 TabIndex = 32 Text = "Freq0" Top = 5280 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 7 Left = 2400 TabIndex = 31 Text = "Freq0" Top = 5040 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 6 Left = 2400 TabIndex = 30 Text = "Freq0" Top = 4800 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 5 Left = 2400 TabIndex = 29 Text = "Freq0" Top = 4560 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 4 Left = 2400 TabIndex = 28 Text = "Freq0" Top = 4320 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 3 Left = 2400 TabIndex = 27 Text = "Freq0" Top = 4080 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 2 Left = 2400 TabIndex = 26 Text = "Freq0" Top = 3840 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 1 Left = 2400 TabIndex = 25 Text = "Freq0" Top = 3600 Width = 1575 End Begin TextBox Freq0 Height = 285 Index = 0 Left = 2400 TabIndex = 24 Text = "Freq0" Top = 3360 Width = 1575 End Begin Gauge Gauge1 Autosize = -1 'True BackColor = &H00000000& ForeColor = &H0000FF00& Height = 4335 InnerBottom = 5 InnerLeft = 5 InnerRight = 5 InnerTop = 5 Left = 840 Max = 100 NeedleWidth = 1 Style = 1 'Vertical Bar TabIndex = 20 Top = 3480 Value = 50 Width = 1455 End Begin TextBox Text7 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 13560 TabIndex = 19 Text = "Text7" Top = 1320 Width = 735 End Begin TextBox Text12 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 10680 TabIndex = 18 Text = "Text12" Top = 360 Width = 975 End Begin TextBox Text11 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 10680 TabIndex = 17 Text = "Text11" Top = 840 Width = 975 End Begin TextBox Text10 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 10680 TabIndex = 16 Text = "Text10" Top = 1320 Width = 975 End Begin TextBox Text6 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 12720 TabIndex = 10 Text = "Text6" Top = 1320 Width = 975 End Begin TextBox Text5 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 12720 TabIndex = 9 Text = "Text5" Top = 840 Width = 855 End Begin TextBox Text1 BackColor = &H00FFFFC0& BorderStyle = 0 'None Height = 375 Left = 12720 TabIndex = 8 Text = "Text1" Top = 360 Width = 855 End Begin PictureBox Picture1 BackColor = &H00404000& DrawWidth = 2 ForeColor = &H0000FF00& Height = 7215 Left = 5280 ScaleHeight = 479 ScaleMode = 3 'Pixel ScaleWidth = 639 TabIndex = 4 Top = 2640 Width = 9615 End Begin TextBox Text4 Height = 375 Index = 15 Left = 1200 TabIndex = 3 Text = "Text4" Top = 9600 Width = 1215 End Begin TextBox Text2 Height = 375 Index = 15 Left = 1200 MultiLine = -1 'True TabIndex = 2 Text = "Text2" Top = 8880 Width = 1215 End Begin TextBox Text3 Height = 375 Index = 15 Left = 1200 TabIndex = 1 Text = "Text3" Top = 9240 Width = 1215 End Begin MSComm Comm1 DTREnable = 0 'False InBufferSize = 1 InputLen = 1 Interval = 1 Left = 14160 NullDiscard = -1 'True RThreshold = 1 SThreshold = 1 Top = 2040 End Begin CommandButton Command1 Caption = "&Quit" Height = 615 Left = 120 TabIndex = 0 Top = 8880 Width = 975 End Begin Label Label21 BackColor = &H00FFFFC0& Caption = "mmHG/MHz" Height = 255 Left = 6000 TabIndex = 12 Top = 1200 Width = 1215 End Begin Label Hand_Gauge_Value BackColor = &H00FFFFC0& Caption = "Hand_Gauge_Value" Height = 255 Left = 960 TabIndex = 60 Top = 8520 Width = 2055 End Begin Label Label20 BackColor = &H00FFFFC0& Caption = "Inst_Freq" Height = 255 Left = 3000 TabIndex = 59 Top = 8160 Width = 855 End Begin Label Label19 BackColor = &H00FFFFC0& Caption = "Mean" Height = 255 Left = 4080 TabIndex = 57 Top = 1800 Width = 495 End Begin Label Label18 BackColor = &H00FFFFC0& Caption = "Const" Height = 255 Left = 4080 TabIndex = 56 Top = 1440 Width = 495 End Begin Label Label17 BackColor = &H00FFFFC0& Caption = "X" Height = 255 Left = 4080 TabIndex = 55 Top = 1080 Width = 495 End Begin Label Label15 BackColor = &H00FFFFC0& Caption = "X^2" Height = 255 Left = 4080 TabIndex = 54 Top = 720 Width = 495 End Begin Label Label16 BackColor = &H00FFFFC0& Caption = "Barometric Pressure" Height = 375 Left = 10800 TabIndex = 47 Top = 2040 Width = 1815 End Begin Label Label14 BackColor = &H00FFFFC0& Caption = "MHz" Height = 255 Left = 14400 TabIndex = 46 Top = 1320 Width = 615 End Begin Label Label13 BackColor = &H00FFFFC0& Caption = "MHz" Height = 255 Left = 14400 TabIndex = 45 Top = 840 Width = 615 End Begin Label Label12 BackColor = &H00FFFFC0& Caption = "MHz" Height = 255 Left = 14400 TabIndex = 44 Top = 360 Width = 615 End Begin Image Image1 Height = 2775 Left = 120 Picture = FORM1.FRX:0302 Stretch = -1 'True Top = 240 Width = 3735 End Begin Label Label11 Caption = "100%---" Height = 255 Left = 120 TabIndex = 23 Top = 3360 Width = 735 End Begin Label Label10 Caption = "50%---" Height = 255 Left = 240 TabIndex = 22 Top = 5520 Width = 615 End Begin Label Label9 Caption = "0%---" Height = 255 Left = 360 TabIndex = 21 Top = 7680 Width = 495 End Begin Label Label8 BackColor = &H00FFFFC0& Caption = "Systolic" Height = 375 Left = 9960 TabIndex = 15 Top = 360 Width = 735 End Begin Label Label7 BackColor = &H00FFFFC0& Caption = "Diastolic" Height = 375 Left = 9840 TabIndex = 14 Top = 840 Width = 855 End Begin Label Label6 BackColor = &H00FFFFC0& Caption = "Mean" Height = 375 Left = 10080 TabIndex = 13 Top = 1320 Width = 615 End Begin Label Label3 BackColor = &H00FFFFC0& Caption = "Mean" Height = 375 Left = 12120 TabIndex = 7 Top = 1320 Width = 615 End Begin Label Label2 BackColor = &H00FFFFC0& Caption = "Diastolic" Height = 255 Left = 11880 TabIndex = 6 Top = 840 Width = 855 End Begin Label Label1 BackColor = &H00FFFFC0& Caption = "Systolic" Height = 255 Left = 12000 TabIndex = 5 Top = 360 Width = 735 End End Sub Comm1_OnComm () On Error GoTo 3000 Static K, Value As Single, xpos, ypos, systolic, diastolic, mean, matrix(2000), matrixfreq(2000) Static index1, sys(2000), dia(2000), M, value1 As Single, value3 As Single, value4 As Single, systolicfreq, diastolicfreq Static value5 As Single, value6 As Single, value2 As Single, newval, aflag, sys1, dia1, oldxpos, meanfreq Static oldval, locked, a$, VALUEX As Single, TEMP, input1 As Single, input2 As Single, input3 As Single, input4 As Single Static input5 As Single, input6 As Single, input7 As Single, ss, INDEX2, input8 As Single, input9 As Single, input10 As Single, input11 As Single Static freq, freqmat(20), valuefreq, freqindex, sysfreq(2000), diafreq(2000) Static value1freq, value2freq, value3freq, value4freq, value5freq, value6freq, valuexfreq, oldvalfreq Static sys1freq, dia1freq, BPINDEX, oldoldvinfreq, oldoldoldvinfreq, vinfreq, vout, vin, oldvinfreq Static oldoldoldvoutfreq, oldoldvoutfreq, oldvoutfreq, voutfreq Static oldoldoldvin, oldoldvin, oldvin, oldoldoldvout, oldoldvout, oldvout Static BP(100), sys2, sys2freq, sys3, sys3freq, sys4, sys4freq Static dia2, dia2freq, dia3, dia3freq, dia4, dia4freq aflag = 0 freq0(0).Visible = 0 VALUEX = Asc(comm1.Input) TEMP = VALUEX TEMP = TEMP And 240 TEMP = TEMP / 16 K = TEMP If K = 12 Then BP(BPINDEX) = VALUEX And 15 If BPINDEX = 23 Then BPINDEX = -1 WORD1 = BP(0) * 4096 + BP(1) * 256 + BP(2) * 16 + BP(3) WORD2 = BP(4) * 4096 + BP(5) * 256 + BP(6) * 16 + BP(7) WORD3 = BP(8) * 4096 + BP(9) * 256 + BP(10) * 16 + BP(11) WORD4 = BP(12) * 4096 + BP(13) * 256 + BP(14) * 16 + BP(15) BPPRESSURE = BP(16) * 4096 + BP(17) * 256 + BP(18) * 16 + BP(19) BPTEMPERATURE = BP(20) * 4096 + BP(21) * 256 + BP(22) * 16 + BP(23) d1 = BPPRESSURE D2 = BPTEMPERATURE Rem WORD1 = 50426 Rem WORD2 = 9504 Rem WORD3 = 48029 Rem WORD4 = 55028 Rem D1 = 17000 Rem D2 = 22500 c1 = WORD1 / 2 C2 = (WORD3 And 63) * 64 + (WORD4 And 63) C3 = (WORD4 And 65472) / 64 C4 = (WORD3 And 65472) / 64 C5 = (WORD1 And 1) * 1024 + ((WORD2 And 65472) / 64) C6 = WORD2 And 63 UT1 = 8 * C5 + 20224 DT = D2 - UT1 TEMP = 200 + DT * (C6 + 50) / 1024 OFFS = C2 * 4 + ((C4 - 512) * DT) / 4096 SENS = c1 + (C3 * DT) / 1024 + 24576 x = (SENS * (d1 - 7168)) / 16384 - OFFS p = x * 10 / 32 + 250 * 10 p = (CInt(p / 1.3328)) / 10 text16.Text = p text16.Visible = -1 End If BPINDEX = BPINDEX + 1 End If If K = 1 Then input1 = VALUEX And 15 BPINDEX = 0 'added 05/27/07 to fix BP data End If If K = 2 Then input2 = VALUEX And 15 End If If K = 3 Then input3 = VALUEX And 15 End If If K = 4 Then input4 = VALUEX TEMP = VALUEX TEMP = TEMP And 240 If TEMP = 64 Then locked = 0 Else locked = 1 End If End If If (K = 5) Then input5 = VALUEX And 15 End If If K = 6 Then input6 = VALUEX And 15 End If If K = 7 Then input7 = VALUEX And 15 End If If K = 8 Then input8 = VALUEX And 15 End If If K = 9 Then input9 = VALUEX And 15 End If If K = 10 Then input10 = VALUEX And 15 End If If K = 11 Then input11 = VALUEX And 15 freq = input8 * 4096 + input9 * 256 + input10 * 16 + input11 Rem freq0(ifreq) = Str$(freq * 12800) freq0(ifreq) = Format$(freq * 12800 / 1000000#, "###.###") + " MHz" freqmat(ifreq) = freq * 12800 / 1000000 ifreq = ifreq + 1 If ifreq > 17 Then ifreq = 0 text8.Text = freq0(17) text9.Text = freq0(1) Rem text8.Visible = -1 Rem text9.Visible = -1 End If End If ss = input5 * 256 + input6 * 16 + input7 If K <> 7 Then GoTo label4 End If ss = (ss / 10 - 14) * 4 Rem text7.Text = Str$(ss) gauge1.Value = ss xpos = xpos + 3 text2(15).Text = Str$(input1) Rem (Asc(comm1.input)) text3(15).Text = Str$(input2 * 16 + input3) Rem Asc(comm1.input) label1: Rem value = Val(text2(15).Text) * 256 + Val(text3(15).Text) Value = input1 * 256 + input2 * 16 + input3 freqindex = 16 - input1 Rem Valuefreq = freqmat(freqindex) - (freqmat(freqindex) - freqmat(freqindex + 1)) * (255 - (input2 * 16 + input3)) / 255 Rem I think that divide by 255 should be divide by 256 valuefreq = freqmat(freqindex) - (freqmat(freqindex) - freqmat(freqindex + 1)) * (255 - (input2 * 16 + input3)) / 256 ss1$ = Str$(ss) + "%" Rem Print #2, Value, ss1$, Time$ text4(15).Text = Str$(Value) q = 4096 / 480 Rem picture1.PSet (xpos, value / q), QBColor(14) If index1 > 119.5 Then index1 = 0 End If INDEX2 = index1 index1 = index1 + 1 INDEX2 = INDEX2 + 1 value1 = value2 value2 = value3 value3 = value4 value4 = value5 value5 = value6 value6 = Value oldval = newval Rem oldoldoldvin = oldoldvin Rem oldoldvin = oldvin Rem oldvin = vin Rem vin = Value Rem oldoldoldvout = oldoldvout Rem oldoldvout = oldvout Rem oldvout = vout Rem vout = (-oldoldoldvin * .095 - oldoldvin * .285 - .285 * oldvin - .095 * vin) Rem vout = (vout - oldoldoldvout + 3.823 * oldoldvout - 5.3829 * oldvout) / -3.3202 Rem newval = vout newval = (value1 + value2 + value3 + value4 + value5 + value6) / 6 value1freq = value2freq value2freq = value3freq value3freq = value4freq value4freq = value5freq value5freq = value6freq value6freq = valuefreq oldvalfreq = newvalfreq Rem oldoldoldvinfreq = oldoldvinfreq Rem oldoldvinfreq = oldvinfreq Rem oldvinfreq = vinfreq Rem vinfreq = valuefreq Rem oldoldoldvoutfreq = oldoldvoutfreq Rem oldoldvoutfreq = oldvoutfreq Rem oldvoutfreq = voutfreq Rem voutfreq = (-oldoldoldvinfreq * .095 - oldoldvinfreq * .285 - .285 * oldvinfreq - .095 * vinfreq) Rem voutfreq = (voutfreq - oldoldoldvoutfreq + 3.823 * oldoldvoutfreq - 5.3829 * oldvoutfreq) / -3.3202 Rem newvalfreq = voutfreq newvalfreq = (value1freq + value2freq + value3freq + value4freq + value5freq + value6freq) / 6 Rem offset1 = vscroll1.Value Rem newvall = 1016 Rem newvalh = 1149 If (input4 = 64) Then Rem picture1.PSet (xpos, (2048 + scale2 * (offset1 + newval)) / q), QBColor(14) picture1.PSet (xpos, ((newval - newvall) * 4095 / (newvalh - newvall)) / q), QBColor(14) Else Rem picture1.Line (oldxpos, (2048 + scale2 * (offset1 + oldval)) / q)-(xpos, (2048 + scale2 * (offset1 + newval)) / q), QBColor(14) picture1.Line (oldxpos, ((oldval - newvall) * 4095 / (newvalh - newvall)) / q)-(xpos, ((newval - newvall) * 4095 / (newvalh - newvall)) / q), QBColor(14) End If Rem oldval = newval Rem oldvalfreq = newvalfreq oldxpos = xpos If (xpos > 639) Then Rem The next two lines are necessary for some reason to prevent a growing latency. comm1.PortOpen = False comm1.PortOpen = True picture1.Cls xpos = 4 oldxpos = 1 End If mean = (newval - matrix(index1)) / 120 + mean meanfreq = (newvalfreq - matrixfreq(index1)) / 120 + meanfreq If (index1 = 40) Then sys2freq = -1000000000 sys2 = -1000000000 dia2 = 1000000000 dia2freq = 1000000000 For i = 1 To 40 If sys(i) > sys2 Then sys2 = sys(i) sys2freq = sysfreq(i) End If If dia(i) < dia2 Then dia2 = dia(i) dia2freq = diafreq(i) End If Next i End If If (index1 = 80) Then sys3freq = -1000000000 sys3 = -1000000000 dia3 = 1000000000 dia3freq = 1000000000 For i = 41 To 80 If sys(i) > sys3 Then sys3 = sys(i) sys3freq = sysfreq(i) End If If dia(i) < dia3 Then dia3 = dia(i) dia3freq = diafreq(i) End If Next i End If If (index1 = 120) Then sys4freq = -1000000000 sys4 = -1000000000 dia4 = 1000000000 dia4freq = 1000000000 For i = 81 To 120 If sys(i) > sys4 Then sys4 = sys(i) sys4freq = sysfreq(i) End If If dia(i) < dia4 Then dia4 = dia(i) dia4freq = diafreq(i) End If Next i End If sys1 = (sys2 + sys3 + sys4) / 3 dia1 = (dia2 + dia3 + dia4) / 3 sys1freq = (sys2freq + sys3freq + sys4freq) / 3 dia1freq = (dia2freq + dia3freq + dia4freq) / 3 matrix(index1) = newval sys(INDEX2) = newval dia(INDEX2) = newval dialostic = sys1 systolic = dia1 matrixfreq(index1) = newvalfreq sysfreq(INDEX2) = newvalfreq diafreq(INDEX2) = newvalfreq dialosticfreq = sys1freq systolicfreq = dia1freq If (index1 Mod 40) = 0 Then text7.Text = Format$(meanfreq, "###.##") text6.Text = (Int(mean)) Text1.Text = (Int(systolic)) text5.Text = (Int(dialostic)) Rem newvalh = systolic Rem newvall = dialostic TEXT13.Text = Format$(systolicfreq, "###.##") TEXT14.Text = Format$(dialosticfreq, "###.##") End If If (svalue <> 0) Then pressure = mvalue + (savemeanfreq - newvalfreq) / svalue Rem text10.Text = (Int(mvalue - ((mean) - sumvalue) * .025 / svalue)) meanpressure = mvalue + (savemeanfreq - meanfreq) / svalue Rem text10.Text = CInt(meanpressure) Rem text12.Text = ((Int((sumvalue - systolic) * .025 / svalue)) + mvalue) systolicpressure = mvalue + (savemeanfreq - systolicfreq) / svalue Rem text12.Text = CInt(systolicpressure) Rem text11.Text = ((Int((sumvalue - dialostic) * .025 / svalue)) + mvalue) dialosticpressure = mvalue + (savemeanfreq - dialosticfreq) / svalue Rem text11.Text = CInt(dialosticpressure) End If Rem adjusted = (Int(mvalue - ((newval) - sumvalue) * .025 / svalue)) If (coeffb <> 0) Then Rem If (newcoeffc = 0) Then Rem newcoeffc = mvalue - coeffa * savemeanfreq ^ 2 - coeffb * savemeanfreq Rem End If pressure = coeffa * newvalfreq ^ 2 + coeffb * newvalfreq + coeffc - p meanpressure = coeffa * meanfreq ^ 2 + coeffb * meanfreq + coeffc - p systolicpressure = coeffa * systolicfreq ^ 2 + coeffb * systolicfreq + coeffc - p dialosticpressure = coeffa * dialosticfreq ^ 2 + coeffb * dialosticfreq + coeffc - p End If If (coeffa = 0) Then fudgefactor = Abs(coeffb) / 3.333 Rem fudgefactor = 0 Else fudgefactor = 0 End If systolicpressure1 = systolicpressure - fudgefactor dialosticpressure1 = dialosticpressure + fudgefactor If (systolicpressure1 < meanpressure) Then systolicpressure1 = meanpressure End If If (dialosticpressure1 > meanpressure) Then dialosticpressure1 = meanpressure End If Rem systolicpressure1 = systolicpressure Rem dialosticpressure1 = dialosticpressure If (index1 Mod 40) = 0 Then text10.Text = CInt(meanpressure) text12.Text = CInt(systolicpressure1) text11.Text = CInt(dialosticpressure1) text24.Text = (CInt(100 * newvalfreq)) / 100 End If Print #2, Int(Value); Int(newval); Int(svalue * 1000) / 1000; Int(mvalue); Int(sumvalue); ss1$; Int(systolic); Int(dialostic); Rem Print #2, ("0" + text12.Text + " "); ("0" + text11.Text + " "); ("0" + text10.Text + " "); Print #2, Time$; Int(100 * newvalfreq) / 100; Print #2, Int(savemeanfreq * 100) / 100; Int(meanfreq * 100) / 100; Int(systolicfreq * 100) / 100; Print #2, Int(dialosticfreq * 100) / 100; Int(meanpressure * 100) / 100; Int(systolicpressure * 100) / 100; Print #2, Int(dialosticpressure * 100) / 100; p; Int(pressure * 100) / 100; Print #2, Int(coeffa * 10000) / 10000; Int(10000 * coeffb) / 10000, Int(10000 * coeffc) / 10000, Int(1000 * Handgaugevalue) / 1000 GoTo label4 3000 Rem MsgBox (Error$) 3020 Rem mvalue = Val(text9.Text) Resume Next label4: End Sub Sub Command1_Click () Close #2 End End Sub Sub Command2_Click () svalue = 0 mvalue = Val(text19.Text) coeffa = Val(text15.Text) coeffb = Val(text17.Text) coeffc = Val(text18.Text) Rem savemeanfreq = Val(text7.Text) Rem subract barometric pressure from coeffc because Rem coeffc has barometric pressure built into it Rem when the sensor was calibrated. You don't have Rem to subtract barometric pressure, p, from newcoeffc Rem if you use Calibrate_To_Mean, because this is all Rem adjusted to the mean. Then you have to adjust the Rem excel data manually for baro pressure between readings Rem on different days newcoeffc = coeffc - p End Sub Sub Command3_Click () svalue = 0 mvalue = Val(text19.Text) coeffa = Val(text15.Text) coeffb = Val(text17.Text) coeffc = Val(text18.Text) savemeanfreq = Val(text7.Text) coeffc = mvalue - coeffa * savemeanfreq ^ 2 - coeffb * savemeanfreq + p text18.Text = Str$((Int(100 * coeffc)) / 100) d$ = Date$ t$ = Time$ f$ = Left$(Time$, 2) + Mid$(Time$, 4, 2) f$ = f$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + "." f$ = f$ + Mid$(Date$, 9, 2) + "f" Rem f$ = a$ + f$ f$ = "c:\vb\files\" + f$ Open f$ For Output As #1 Print #1, text15.Text Print #1, text17.Text Print #1, text18.Text Print #1, text19.Text Print #1, savemeanfreq + 0 Print #1, text16.Text Close #1 End Sub Sub Command4_Click () file1.Visible = 0 End Sub Sub Command6_Click () Rem On Local Error GoTo 32000 Rem a$ = InputBox$("Type Filename to Save Data") Rem If a$ = "" Then GoTo overx Rem x = InStr(a$, ".") Rem If x <> 0 Then a$ = Left$(a$, x - 1) Rem If InStr(a$, "\") = 0 Then a$ = "files\" + a$ d$ = Date$ t$ = Time$ f$ = Left$(Time$, 2) + Mid$(Time$, 4, 2) f$ = f$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + "." f$ = f$ + Mid$(Date$, 9, 2) + "f" Rem f$ = a$ + f$ f$ = "c:\vb\files\" + f$ Open f$ For Output As #1 Print #1, text15.Text Print #1, text17.Text Print #1, text18.Text Print #1, text19.Text Print #1, savemeanfreq + 0 Print #1, text16.Text Close #1 GoTo overx 32000 Resume Next overx: End Sub Sub Command7_Click () file1.Visible = -1 file1.Pattern = "*.txt" file1.Path = "c:\vb\files" file1.Pattern = "*.*" Rem dir1.Path = "files\" End Sub Sub Command8_Click () GoTo avoid1 pressh = Val(text20.Text) coeffa = Val(text15.Text) coeffb = Val(text17.Text) coeffc = Val(text18.Text) freql = 2 * (newcoeffc - (pressh - 0)) If coeffb < 0 Then freql = freql / (-coeffb + Sqr(coeffb ^ 2 - 4 * coeffa * (newcoeffc - (pressh - 0)))) Else freql = freql / (-coeffb - Sqr(coeffb ^ 2 - 4 * coeffa * (newcoeffc - (pressh - 0)))) End If pressl = Val(text21.Text) freqh = 2 * (newcoeffc - (pressl - 0)) If coeffb < 0 Then freqh = freqh / (-coeffb + Sqr(coeffb ^ 2 - 4 * coeffa * (newcoeffc - (pressl - 0)))) Else freqh = freqh / (-coeffb - Sqr(coeffb ^ 2 - 4 * coeffa * (newcoeffc - (pressl - 0)))) End If text22.Text = Str$(freql) text23.Text = Str$(freqh) newvalh = (freqh - Val(freq0(17))) * 4096 / (Val(freq0(1)) - Val(freq0(17))) newvall = (freql - Val(freq0(17))) * 4096 / (Val(freq0(1)) - Val(freq0(17))) Rem text22.Text = Str$(newvall) Rem text23.Text = Str$(newvalh) avoid1: newvalh = Val(text21.Text) newvall = Val(text20.Text) End Sub Sub Command9_Click () notes.Visible = -1 a$ = "Calibrate uses coefficients X^2, X, and" + Chr$(13) + Chr$(10) a$ = a$ + "Const - Barometric Pressure, only, to " + Chr$(13) + Chr$(10) a$ = a$ + "calibrate the sensor. The pressure" + Chr$(13) + Chr$(10) a$ = a$ + "becomes Pressure = ax^2+bx+c-bp" + Chr$(13) + Chr$(10) a$ = a$ + Chr$(13) + Chr$(10) a$ = a$ + "Calibrate_To_Mean determines by " + Chr$(13) + Chr$(10) a$ = a$ + "Pressure = ax^2+bx+newC where newC" + Chr$(13) + Chr$(10) a$ = a$ + "is calculated such that the" + Chr$(13) + Chr$(10) a$ = a$ + "pressure matches that typed into the" + Chr$(13) + Chr$(10) a$ = a$ + "textbox when x is the frequency at " + Chr$(13) + Chr$(10) a$ = a$ + "the time that the Calibrate_To_Mean" + Chr$(13) + Chr$(10) a$ = a$ + "button is pressed." + Chr$(13) + Chr$(10) a$ = a$ + Chr$(13) + Chr$(10) a$ = a$ + "The Save button saves the coefficients" + Chr$(13) + Chr$(10) a$ = a$ + "of x^2, x, Const, Mean, and the" + Chr$(13) + Chr$(10) a$ = a$ + "frequency at the time the " + Chr$(13) + Chr$(10) a$ = a$ + "Calibrate_To_Mean button was " + Chr$(13) + Chr$(10) a$ = a$ + "pressed. A new filename is " + Chr$(13) + Chr$(10) a$ = a$ + "automatically created but will " + Chr$(13) + Chr$(10) a$ = a$ + "overwrite the last filename if the " + Chr$(13) + Chr$(10) a$ = a$ + "last file was created less than a " + Chr$(13) + Chr$(10) a$ = a$ + "minute ago" + Chr$(13) + Chr$(10) a$ = a$ + Chr$(13) + Chr$(10) a$ = a$ + "Recall recalls the coefficients" + Chr$(13) + Chr$(10) a$ = a$ + "of x^2, x, Const, Mean and the " + Chr$(13) + Chr$(10) a$ = a$ + "frequency at which the mean was" + Chr$(13) + Chr$(10) a$ = a$ + "calibrated to and used them " + Chr$(13) + Chr$(10) a$ = a$ + "immediately. It also recalls " + Chr$(13) + Chr$(10) a$ = a$ + "the previous barometric pressure" + Chr$(13) + Chr$(10) a$ = a$ + "but does nothing with it." + Chr$(13) + Chr$(10) a$ = a$ + Chr$(13) + Chr$(10) notes.Text1.Text = a$ End Sub Sub File1_DblClick () h$ = file1.FileName h$ = "c:\vb\files\" + h$ Open h$ For Input As #1 Input #1, a1 Input #1, b1 Input #1, c1 Input #1, d1 Input #1, e1 Input #1, f1 Close #1 text15.Text = a1 text17.Text = b1 text18.Text = c1 text19.Text = d1 savemeanfreq = e1 oldbaro = f1 newcoeffc = 0 svalue = 0 mvalue = Val(text19.Text) coeffa = Val(text15.Text) coeffb = Val(text17.Text) coeffc = Val(text18.Text) file1.Visible = 0 End Sub Sub File1_LostFocus () file1.Visible = 0 End Sub Sub Form_GotFocus () file1.Visible = 0 End Sub Sub Form_Load () comm1.CommPort = 1 comm1.Settings = "9600,N,8,1" comm1.PortOpen = True picture1.ScaleMode = 3 file1.Visible = 0 command2.Visible = 0 command9.Visible = 0 command4.Visible = -1 newvall = 0 newvalh = 4095 text19.Text = "20" command8.Visible = -1 text20.Visible = -1 text21.Visible = -1 text22.Visible = 0 text23.Visible = 0 notes.Visible = 0 text8.Visible = 0 text9.Visible = 0 text20.Text = "0" text21.Text = "4095" text15.Text = "-0.0514" text17.Text = "5.4727" text18.Text = "2991.5" text10.Text = "" text11.Text = "" text12.Text = "" text25.Text = "" Rem text15.Text = "740" gauge1.Min = 0 gauge1.Max = 100 gauge1.Value = 0 Rem text7.Visible = 0 text2(15).Visible = 0 text3(15).Visible = 0 text4(15).Visible = 0 pickone = 0 ifreq = 0 BPINDEX = 0 text16.Text = "0" text16.Visible = 0 newcoeffc = 0 21 c$ = "" 22 d$ = Date$ 23 t$ = Time$ 24 f$ = Left$(Time$, 2) + Mid$(Time$, 4, 2) 25 f$ = f$ + Left$(Date$, 2) + Mid$(Date$, 4, 2) + "." 26 f$ = f$ + Mid$(Date$, 9, 2) + "C" 27 f$ = "c:\vb\excel\" + f$ 35 Open f$ For Output As #2 Print #2, "| Raw Average Slope Mean Raw Signal Systolic Diastolic Time Frequency Mean Mean Systolic Diastolic Mean Systolic Diastolic Barometric Pressure COEF_X^2 COEF_X COEF_Const Hand_Gauge_Val" Print #2, "| value of in number value strength Raw Raw | | Frequency Frequency Frequency Freuquency Pressure Pressure Pressure Pressure" Print #2, "| | last MHz to at | DAC DAC | | at | " Print #2, "| | 6 of calibrate time | Number Number | | time |" Print #2, "| | values the to. the | | | | | calibrate |" Print #2, "| | | sensor. This calibrate | | | | | button |" Print #2, "| | | This is button | | | | | was |" Print #2, "| | | is zero is | | | | | pressed. | | | |" Print #2, "| | | zero until pressed." Print #2, "| | | until the This" Print #2, "| | | the calibrate is" Print #2, "| | | calibrate button zero" Print #2, "| | | button is until" Print #2, "| | | is pressed. the" Print #2, "| | | pressed. | calibrate" Print #2, "| | | | | button" Print #2, "| | | | | is" Print #2, "| | | | | pressed." Rem Print #2, "Raw value" Rem Print #2, "Average of last 6 values" Rem Print #2, "Slope in MHz of the sensor. This is zero until the calibrate button is pressed. " Rem Print #2, "Mean number to Calibrate to. This is zero until the calibrate button is pressed." Rem Print #2, "Raw value at time the calibrate button is pressed. This is zero until the calibrate button is pressed." Rem Print #2, "Signal Strength" Rem Print #2, "Systolic Raw DAC Number" Rem Print #2, "Diastolic Raw DAC Number" Rem Print #2, "Systolic Pressure after calibrate button is pressed." Rem Print #2, "Diastolic Pressure after calibrate button is pressed." Rem Print #2, "Mean Pressure after calibrate button is pressed." Rem Print #2, "Time" Rem Raw value, average of 6, slope, mean to cal to, raw value at time cal button is pressed, ss, time, int(systolic), int(dialostic) End Sub Sub Form_Unload (Cancel As Integer) Close #2 End Sub Sub Image1_Click () Static pickone If pickone = 0 Then image1.Picture = LoadPicture("svs2005.bmp") End If If pickone = 1 Then image1.Picture = LoadPicture("060315.bmp") End If If pickone = 2 Then image1.Picture = LoadPicture("fourofth.bmp") End If text7.Text = Str$(pickone) pickone = pickone + 1 If pickone > 2 Then pickone = 0 End If End Sub Sub Text25_LostFocus () Handgaugevalue = Val(text25.Text) End Sub