80分求助!!!关于单片机的上位机编程问题

[复制链接]
查看11 | 回复2 | 2010-5-4 15:43:40 | 显示全部楼层 |阅读模式
借本VB的书,挺简单的。。
回复

使用道具 举报

千问 | 2010-5-4 15:43:40 | 显示全部楼层
这个建议你用c++ builder 借一本初级书,一步步来很快的,这个软件是个快速开发工具,易上手,但也强大,我的上位机软件就用它很快做好的,做串口通信很方便
回复

使用道具 举报

千问 | 2010-5-4 15:43:40 | 显示全部楼层
Private Sub Timer1_Timer()If Label1.CaptionCStr(Time$) Then
Label1.Caption = Time$
sum_zj = sum_zj + 1
Text3 = sum_zj
'校准
If sum_zj >= 3 Then
sum_zj1 = sum_zj1 + 1
sum_zj = sum_zj - 3
Text4 = sum_zj1
Adodc1.Recordset.AddNew '每3秒记录一组数据
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)'记录数据
Adodc1.Recordset(3) = record_jm(1)'记录数据
Adodc1.Recordset(4) = record_jm(2)'记录数据
Adodc1.Recordset(5) = record_jm(3)'记录数据
Adodc1.Recordset(6) = record_jm(4)'记录数据
Adodc1.Recordset(7) = record_jm(5)'记录数据
Adodc1.Recordset(8) = record_jm(6)'记录数据
Adodc1.Recordset(9) = record_jm(7)'记录数据
Adodc1.Recordset(10) = record_jm(8)'记录数据
Adodc1.Recordset(11) = record_jm(9)'记录数据
Adodc1.Recordset(12) = record_jm(10)'记录数据
Adodc1.Recordset(13) = record_jm(11)'记录数据
Adodc1.Recordset.Update
End If
End IfEnd SubPrivate Sub Timer2_Timer()Picture4.DrawStyle = 0以下代码绘制实时曲线(6点):Picture4.DrawWidth = 3 ' = dashPicture4.Line (sum_z1 * 18 + 500, record_jm(0) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(2) * -150 + 7900), vbRed ', BFPicture4.Line (sum_z1 * 18 + 500, record_jm(1) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(3) * -150 + 7900), vbCyan ', BFPicture4.Line (sum_z1 * 18 + 500, record_jm(2) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(4) * -150 + 7900), vbBlack ', BFPicture4.Line (sum_z1 * 18 + 500, record_jm(3) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(5) * -150 + 7900), vbMagenta ', BFPicture4.Line (sum_z1 * 18 + 500, record_jm(4) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(6) * -150 + 7900), vbGreen ', BFPicture4.Line (sum_z1 * 18 + 500, record_jm(5) * -150 + 7900)-(sum_z1 * 18 + 500, record_jm(7) * -150 + 7900), vbBlue ', BFEnd SubPrivate Sub Timer3_Timer()If Label32CStr(Time$) Then 'Label1.Caption
Label32.Caption = Time$
sum_z = sum_z + 1
Text31 = sum_z
'校准
If sum_z >= 5 Then
sum_z = sum_z - 5
sum_z1 = sum_z1 + 1
Text30 = sum_z1
End IfEnd IfEnd Sub以下代码绘制曲线的坐标:Private Sub Form_Load()With Adodc1Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\kongtiao\cartemp.mdb;Persist Security Info=False"Adodc1.RecordSource = "select * form car_bm"End WithText1 = ""Text2 = "": Text3 = "": Text4 = "":Text5 = "": Text6 = "": Text7 = "": Text12 = ""Text8 = "": Text9 = "": Text10 = "": Text11 = ""Text13 = "": Text14 = "": Text15 = "": Text16 = ""'Load frmMaincolvb = vbBlackxx = 100yy = 150txt = "℃"wp = xp(colvb, xx, yy, txt)xx = 200yy = 350txt = "50"wp = xp(colvb, xx, yy, txt)xx = 200yy = 1850txt = "40"wp = xp(colvb, xx, yy, txt)yy = 3350xx = 200txt = "30"wp = xp(colvb, xx, yy, txt)xx = 200yy = 4850txt = "20"wp = xp(colvb, xx, yy, txt)xx = 200yy = 6350txt = "10"wp = xp(colvb, xx, yy, txt)'Time坐标colvb = vbRedyy = 6500xx = 400txt = "0"wp = xp(colvb, xx, yy, txt)xx = 1480txt = "5"wp = xp(colvb, xx, yy, txt)xx = 2560txt = "10"wp = xp(colvb, xx, yy, txt)xx = 3640txt = "15"wp = xp(colvb, xx, yy, txt)xx = 4720txt = "20"wp = xp(colvb, xx, yy, txt)xx = 5800txt = "25min"wp = xp(colvb, xx, yy, txt)xx = 6880txt = "30"wp = xp(colvb, xx, yy, txt)xx = 7960txt = "35"wp = xp(colvb, xx, yy, txt)xx = 9040txt = "40"wp = xp(colvb, xx, yy, txt)xx = 10120txt = "45"wp = xp(colvb, xx, yy, txt)xx = 11200txt = "50"wp = xp(colvb, xx, yy, txt)'画格Picture1.DrawWidth = 1 ' = dashPicture1.DrawStyle = 0Picture1.ForeColor = vbCyanFor i = 0 To 39Picture4.Line (450, 550 + i * 150)-(500, 550 + i * 150)NextPicture4.DrawStyle = 2For i = 0 To 8Picture4.Line (450, 400 + i * 750)-(11300, 400 + i * 750)NextFor i = 0 To 15Picture4.Line (450, 1000 + i * 300)-(500, 1000 + i * 300)NextFor i = 0 To 10Picture4.Line (500 + i * 1080, 400)-(500 + i * 1080, 6400)NextPicture4.DrawStyle = 0End Sub上述代码供参考.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行