vb程序?qū)崿F(xiàn)串口通信,將接到的數(shù)據(jù)動態(tài)保存,并可以圖表繪制曲_第1頁
vb程序?qū)崿F(xiàn)串口通信,將接到的數(shù)據(jù)動態(tài)保存,并可以圖表繪制曲_第2頁
vb程序?qū)崿F(xiàn)串口通信,將接到的數(shù)據(jù)動態(tài)保存,并可以圖表繪制曲_第3頁
vb程序?qū)崿F(xiàn)串口通信,將接到的數(shù)據(jù)動態(tài)保存,并可以圖表繪制曲_第4頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論