发布时间 : 星期日 文章2013-生物传感器实验1-第九组-论文更新完毕开始阅读
2013-生物传感器实验1-第九组-论文
Dim DataValue As Integer
Dim HighResEngUnits As Double Dim EngUnits As Single
' Collect the data with cbAIn()
' Parameters:
' BoardNum :the number used by CB.CFG to describe this board ' Chan :the input channel number ' CBRange :the Range for the board.
' DataValue :the name for the value collected
Chan = Val(TxtNumChan.Text) ' set input channel If (Chan > MaxChan) Then Chan = MaxChan TxtNumChan.Text = Format(Chan, \ Options = 0 ' this is ignored
If ADResolution > 16 Then
ULStat = cbAIn32(BoardNum, Chan, CBRange, DataValue32, Options) If ULStat <> 0 Then Stop
ULStat = cbToEngUnits32(BoardNum, CBRange, DataValue32, HighResEngUnits) If ULStat <> 0 Then Stop
lblShowData.Caption = Format$(DataValue32, \
lblShowVolts.Caption = Format$(HighResEngUnits#, \voltage
Else
ULStat = cbAIn(BoardNum, Chan, CBRange, DataValue) If ULStat <> 0 Then Stop
ULStat = cbToEngUnits(BoardNum, CBRange, DataValue, EngUnits) If ULStat <> 0 Then Stop
lblShowData.Caption = Format$(DataValue, \
lblShowVolts.Caption = Format$(EngUnits!, \ End If
data(i) = Format$(EngUnits!, \采集y轴的数据
Print #1, i, \将采集到的数据存储到csv文件中 If (i > 0) Then '绘制曲线 Pic.DrawStyle = 0 Pic.DrawWidth = 1
Pic.Line (TimeCount - 1 - mult * 100, data(i - 1))-(TimeCount - mult * 100, data(i)) End If i = i + 1
TimeCount = TimeCount + 1
If i - 1 = m Then '曲线绘制到最右端时,往左移动横轴1/5的距离
m = m + 100 mult = mult + 1
lcall (m) '调用lcall子程序 End If
End Sub
Private Sub lcall(m As Integer) '定义lcall子程序 Pic.Cls '清屏
第 9 页 共 9 页
2013-生物传感器实验1-第九组-论文
Pic.DrawWidth = 1
For X = 0 To 500 Step 100 '画x轴
Pic.DrawStyle = 3 '设置曲线宽度 Pic.Line (X, -4)-(X, 4) Next X
For Y = -4 To 4 '画y轴 Pic.Line (500, Y)-(0, Y) Next Y
x1.Caption = 10 + mult * 10 '定义各坐标显示的数字 x2.Caption = 20 + mult * 10 x3.Caption = 30 + mult * 10 x4.Caption = 40 + mult * 10 x5.Caption = 50 + mult * 10
a0 = 0
For a = i - 400 To i '清屏之后重新绘制横轴4/5的曲线
Pic.Line (a0, data(a))-(a0 + 1, data(a + 1)) a0 = a0 + 1 Next a End Sub
Private Sub CmdSave_Click() '改变的线条的颜色 CommonDialog1.ShowColor
Pic.ForeColor = CommonDialog1.Color End Sub
Private Sub pic_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '显示鼠标指针的坐标
If X > 0 And X < 500 And Y > -4 And Y < 4 Then
frmDataDisplay.Caption = \细菌生长曲线( X=\秒 Y=\+ Str(Y) + \伏 )\
End If End Sub
Private Sub Compause_Click() '使能端,控制数据采集的开断 If tmrConvert.Enabled = True Then tmrConvert.Enabled = False Compause.Caption = \继续\ Else
tmrConvert.Enabled = True Compause.Caption = \暂停\ End If End Sub
Private Sub cmdStopConvert_Click() '数据采集结束 tmrConvert.Enabled = False End End Sub
第 10 页 共 10 页