



下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、vb程序?qū)崿F(xiàn)串口通信,將接到的數(shù)據(jù)動態(tài)保存,并可以圖表繪制曲線(X:時間,Y:數(shù)據(jù))將接到的數(shù)據(jù)賦值于全局變量,通過ADO數(shù)據(jù)控件連接數(shù)據(jù)庫及表,用以下代碼保存數(shù)據(jù): Private Sub Timer1_Timer() If Label1.Caption CStr(Time$) Then Label1.Caption = Time$ sum_zj = sum_zj + 1 Text3 = sum_zj 校準(zhǔn) If sum_zj = 3 Then sum_zj1 = sum_zj1 + 1 sum_zj = sum_zj - 3 Text4 = sum_zj1 Adodc1.Recordset
2、.AddNew 每3秒記錄一組數(shù)據(jù) Adodc1.Recordset(0) = shiYAnH Adodc1.Recordset(1) = Mid(Time$, 1, 2) & Mid(Time$, 4, 2) & Mid(Time$, 7, 2) 記錄time Adodc1.Recordset(2) = record_jm(0) 記錄數(shù)據(jù) Adodc1.Recordset(3) = record_jm(1) 記錄數(shù)據(jù) Adodc1.Recordset(4) = record_jm(2) 記錄數(shù)據(jù) Adodc1.Recordset(5) = record_jm(3) 記錄數(shù)據(jù) Adodc1.R
3、ecordset(6) = record_jm(4) 記錄數(shù)據(jù) Adodc1.Recordset(7) = record_jm(5) 記錄數(shù)據(jù) Adodc1.Recordset(8) = record_jm(6) 記錄數(shù)據(jù) Adodc1.Recordset(9) = record_jm(7) 記錄數(shù)據(jù) Adodc1.Recordset(10) = record_jm(8) 記錄數(shù)據(jù) Adodc1.Recordset(11) = record_jm(9) 記錄數(shù)據(jù) Adodc1.Recordset(12) = record_jm(10) 記錄數(shù)據(jù) Adodc1.Recordset(13) = r
4、ecord_jm(11) 記錄數(shù)據(jù) Adodc1.Recordset.Update End If End If End Sub Private Sub Timer2_Timer() Picture4.DrawStyle = 0 以下代碼繪制實(shí)時曲線(6點(diǎn)): Picture4.DrawWidth = 3 = dash Picture4.Line (sum_z1 * 18 + 500, record_jm(0) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(2) * -150 + 7900), vbRed , BF Picture4.Line (sum
5、_z1 * 18 + 500, record_jm(1) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(3) * -150 + 7900), vbCyan , BF Picture4.Line (sum_z1 * 18 + 500, record_jm(2) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(4) * -150 + 7900), vbBlack , BF Picture4.Line (sum_z1 * 18 + 500, record_jm(3) * -150 + 7900)-(sum_z1 *
6、 18 + 500, record_jm(5) * -150 + 7900), vbMagenta , BF Picture4.Line (sum_z1 * 18 + 500, record_jm(4) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(6) * -150 + 7900), vbGreen , BF Picture4.Line (sum_z1 * 18 + 500, record_jm(5) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(7) * -150 + 7900), vbBlue , B
7、F End Sub Private Sub Timer3_Timer() If Label32 CStr(Time$) Then Label1.Caption Label32.Caption = Time$ sum_z = sum_z + 1 Text31 = sum_z 校準(zhǔn) If sum_z = 5 Then sum_z = sum_z - 5 sum_z1 = sum_z1 + 1 Text30 = sum_z1 End If End If End Sub 以下代碼繪制曲線的坐標(biāo): Private Sub Form_Load() With Adodc1 Adodc1.Connection
8、String = Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & App.Path & kongtiaocartemp.mdb;Persist Security Info=False Adodc1.RecordSource = select * form car_bm End With Text1 = Text2 = : Text3 = : Text4 = : Text5 = : Text6 = : Text7 = : Text12 = Text8 = : Text9 = : Text10 = : Text11 = Text13 = : Text
9、14 = : Text15 = : Text16 = Load frmMain colvb = vbBlack xx = 100 yy = 150 txt = wp = xp(colvb, xx, yy, txt) xx = 200 yy = 350 txt = 50 wp = xp(colvb, xx, yy, txt) xx = 200 yy = 1850 txt = 40 wp = xp(colvb, xx, yy, txt) yy = 3350 xx = 200 txt = 30 wp = xp(colvb, xx, yy, txt) xx = 200 yy = 4850 txt =
10、20 wp = xp(colvb, xx, yy, txt) xx = 200 yy = 6350 txt = 10 wp = xp(colvb, xx, yy, txt) Time坐標(biāo) colvb = vbRed yy = 6500 xx = 400 txt = 0 wp = xp(colvb, xx, yy, txt) xx = 1480 txt = 5 wp = xp(colvb, xx, yy, txt) xx = 2560 txt = 10 wp = xp(colvb, xx, yy, txt) xx = 3640 txt = 15 wp = xp(colvb, xx, yy, tx
11、t) xx = 4720 txt = 20 wp = xp(colvb, xx, yy, txt) xx = 5800 txt = 25 min wp = xp(colvb, xx, yy, txt) xx = 6880 txt = 30 wp = xp(colvb, xx, yy, txt) xx = 7960 txt = 35 wp = xp(colvb, xx, yy, txt) xx = 9040 txt = 40 wp = xp(colvb, xx, yy, txt) xx = 10120 txt = 45 wp = xp(colvb, xx, yy, txt) xx = 11200
12、 txt = 50 wp = xp(colvb, xx, yy, txt) 畫格 Picture1.DrawWidth = 1 = dash Picture1.DrawStyle = 0 Picture1.ForeColor = vbCyan For i = 0 To 39 Picture4.Line (450, 550 + i * 150)-(500, 550 + i * 150) Next Picture4.DrawStyle = 2 For i = 0 To 8 Picture4.Line (450, 400 + i * 750)-(11300, 400 + i * 750) Next
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 信息化技術(shù)在農(nóng)業(yè)生產(chǎn)中的合作協(xié)議
- 農(nóng)民工在崗培訓(xùn)與勞務(wù)派遣合同
- 購買物業(yè)管理服務(wù)協(xié)議書
- 農(nóng)業(yè)生產(chǎn)經(jīng)營資金互助保障協(xié)議
- 智慧寓言伊索寓言故事解讀
- 高考語文復(fù)習(xí):專題六、七
- 體育培訓(xùn)中心學(xué)員意外事故的免責(zé)及保障協(xié)議
- 高考文言文斷句100題專項(xiàng)練習(xí)(附答案及翻譯最方便)
- 小馬過河自我成長的故事解讀
- 農(nóng)業(yè)旅游開發(fā)手冊
- GA/T 701-2024安全防范指紋識別應(yīng)用出入口控制指紋識別模塊通用規(guī)范
- 2025年阜新高等專科學(xué)校單招職業(yè)傾向性測試題庫附答案
- 2025年包頭輕工職業(yè)技術(shù)學(xué)院單招職業(yè)適應(yīng)性測試題庫及答案一套
- 《養(yǎng)老保險的理念》課件
- 2024-2025學(xué)年第二學(xué)期英語教研組工作計劃
- 山東省海洋知識競賽(初中組)考試題庫500題(含答案)
- 服務(wù)行業(yè)人力資源薪酬體系管理與優(yōu)化
- 《蔚來發(fā)展》課件
- 人工智能融入土木水利碩士人才培養(yǎng)模式研究
- 2024年山東商務(wù)職業(yè)學(xué)院高職單招語文歷年參考題庫含答案解析
- 醫(yī)學(xué)教育中的學(xué)習(xí)風(fēng)格與個性化教學(xué)
評論
0/150
提交評論