当前位置:首页 > 代码 > 正文

vbgps数据采集代码(vb采集plc数据)

admin 发布:2022-12-19 11:49 146


今天给各位分享vbgps数据采集代码的知识,其中也会对vb采集plc数据进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!

本文目录一览:

VB中如何实时读取GPS信息

书上估计是用的定时器接收,窗体上拖MSComm1,Timer1,Text1控件各一个,并在属性设置好MSComm1的波特率,串口号,起始位,停止位等信息

Dim str_dispaly As String '定义回显字符

Private Sub Form_Load()

Me.MSComm1.PortOpen = True

Me.Timer1.Interval = 100 '定时器时间间隔

Me.Timer1.Enabled = True

End Sub

Private Sub Timer1_Timer()

If MSComm1.InBufferCount 0 Then

str_dispaly = str_dispaly MSComm1.Input

Me.Text1.Text = str_display

End If

End Sub

vb脚本如何实现每15分钟采集数据

使用定时器控件,在控件内编码!

或者使用Windows api函数

或者使用循环,利用datadiff函数

你可以把下面代码保存为vbs文件:每隔15秒就会出现一个对话框,你可以根据你的需要进行修改!

dim i,dt

dt=now()

i=0

do until i=20

i=datediff("s",dt,now())

if i=15 then

msgbox "采集数据"

i=0

dt=now()

end if

loop

求有关GPS数据模拟生成器VB源代码

“GPS”即全球定位系统(Global Positioning System)。

简单地说,这是一个由覆盖全球的24颗卫星组成的卫星系统。这个系统可以保证在任意时刻,地球上任意一点都可以同时观测到4颗卫星,以保证卫星可以采集到该观测点的经纬度和高度,以便实现导航、定位、授时等功能。这项技术可以用来引导飞机、船舶、车辆以及个人,安全、准确地沿着选定的路线,准时到达目的地。

“GPS”是20世纪70年代由美国陆海空三军联合研制的新一代空间卫星导航定位系统 。其主要目的是为陆、海、空三大领域提供实时、 全天候和全球性的导航服务,并用于情报收集、核爆监测和应急通讯等一些军事目的,是美国独霸全球战略的重要组成。经过20余年的研究实验,耗资300亿美元,到1994年3月,全球覆盖率高达98%的24颗GPS卫星星座己布设完成。

GPS全球卫星定位系统由三部分组成:空间部分———GPS星座;地面控制部分———地面监控系统;用户设备部分———GPS 信号接收机。

GPS定位技术具有高精度、高效率和低成本的优点,使其在各类大地测量控制网的加强改造和建立以及在公路工程测量和大型构造物的变形测量中得到了较为广泛的应用。

如果你是用于汽车安装,汽车城就有,但是初装费有3000到6000不等,每月的服务费是600到1200不等。安装了GPS系统的车辆,便于卫星定位,如果被盗或发生事故,容易破案。

VB 串口数据采集

实时采集的数据可直接用来画曲线,但往往为了以后查询,同时应按定时间隔写入数据库或文本文件。所以可在写入数据库后通过查询做到实时显示和更新。

'窗体加载时将已记录的数据查询后绘图

Private Sub Form_Load()

chaxun1 = "select * from jishijilu where gyh_riqi='" gongyi_sj(0) "-" record_rq "'order by shijian "

mdh = chaxun1

Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"

Adodc3.RecordSource = mdh

Adodc3.Refresh

zslNew = Adodc3.Recordset.RecordCount

Text4 = zslNew

If zslNew = 1 Then

Adodc3.Recordset.MoveFirst

For i = 0 To zslNew - 1

quexian(0, i) = Adodc3.Recordset(0)

For j = 2 To 9

quexian(j, i) = Adodc3.Recordset(j)

Next j

Adodc3.Recordset.MoveNext

Next i

Adodc3.Recordset.MoveFirst

For j = 0 To zslNew - 1

Picture1.Line (j * 5 + 500, quexian(2, j) * -30 + 3399)-(j * 5 + 500, quexian(2, j) * -30 + 3401), vbRed, BF

Picture1.Line (j * 5 + 500, quexian(3, j) * -30 + 3399)-(j * 5 + 500, quexian(3, j) * -30 + 3401), QBColor(7), BF

Picture1.Line (j * 5 + 500, quexian(4, j) * -30 + 3399)-(j * 5 + 500, quexian(4, j) * -30 + 3401), vbWhite, BF

Picture1.Line (j * 5 + 500, quexian(5, j) * -30 + 3399)-(j * 5 + 500, quexian(5, j) * -30 + 3401), vbYellow, BF

Picture1.Line (j * 5 + 500, quexian(6, j) * -30 + 3399)-(j * 5 + 500, quexian(6, j) * -30 + 3401), vbGreen, BF

If quexian(8, j) 1 Then

wy_wy = 0 + 166.7

br_br = 55

ElseIf quexian(8, j) = 1 And quexian(8, j) 10 Then

wy_wy = -1500 + 166.7

br_br = 5.5556

ElseIf quexian(8, j) = 10 And quexian(8, j) 100 Then

wy_wy = -3000 + 166.7

br_br = 0.5555

ElseIf quexian(8, j) = 100 And quexian(8, j) 1000 Then

wy_wy = -4500 + 166.7

br_br = 0.055555

End If

Picture1.Line (j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3397 + 3000)-(j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3403 + 3000), QBColor(11), BF

Next j

zslOld = zslNew

End If

'记录时间最长75小时

Picture2.Height = 10000

Picture2.Visible = True

Picture1.Visible = True

colvb = vbWhite

xx = 100

yy = 150

txt = "℃"

wp = xp(colvb, xx, yy, txt)

yy = 350

txt = "100"

wp = xp(colvb, xx, yy, txt)

xx = 200

yy = 1850

txt = "50"

wp = xp(colvb, xx, yy, txt)

yy = 3350

xx = 300

txt = "0"

wp = xp(colvb, xx, yy, txt)

xx = 100

yy = 4850

txt = "-50"

wp = xp(colvb, xx, yy, txt)

xx = 0

yy = 6350

txt = "-100"

wp = xp(colvb, xx, yy, txt)

xx = 10800 + 100

yy = 150

txt = "℃"

wp = xp(colvb, xx, yy, txt)

yy = 350

txt = "100"

wp = xp(colvb, xx, yy, txt)

xx = 10800 + 200

yy = 1850

txt = "50"

wp = xp(colvb, xx, yy, txt)

yy = 3350

xx = 10800 + 300

txt = "0"

wp = xp(colvb, xx, yy, txt)

xx = 10800 + 100

yy = 4850

txt = "-50"

wp = xp(colvb, xx, yy, txt)

xx = 10800 + 0

yy = 6350

txt = "-100"

wp = xp(colvb, xx, yy, txt)

'真空坐标

colvb = vbRed

xx = 11400

yy = 150

txt = "Pa"

wp = xp(colvb, xx, yy, txt)

yy = 350

txt = "1000"

wp = xp(colvb, xx, yy, txt)

xx = 11500

yy = 1850

txt = "100"

wp = xp(colvb, xx, yy, txt)

yy = 3350

xx = 11600

txt = "10"

wp = xp(colvb, xx, yy, txt)

xx = 11700

yy = 4850

txt = "1"

wp = xp(colvb, xx, yy, txt)

xx = 11500

yy = 6350

txt = "0.1"

wp = xp(colvb, xx, yy, txt)

xx = 500

yy = 150

txt = "Pa"

wp = xp(colvb, xx, yy, txt)

yy = 350

txt = "1000"

wp = xp(colvb, xx, yy, txt)

yy = 150

xx = 2200

txt = "6hr"

wp = xp(colvb, xx, yy, txt)

xx = 4000

txt = "12hr"

wp = xp(colvb, xx, yy, txt)

xx = 5800

txt = "18hr"

wp = xp(colvb, xx, yy, txt)

xx = 7600

txt = "24hr"

wp = xp(colvb, xx, yy, txt)

xx = 9400

txt = "30hr"

wp = xp(colvb, xx, yy, txt)

xx = 13000

txt = "42hr"

wp = xp(colvb, xx, yy, txt)

xx = 14800

txt = "48hr"

wp = xp(colvb, xx, yy, txt)

xx = 16600

txt = "54hr"

wp = xp(colvb, xx, yy, txt)

xx = 18400

txt = "60hr"

wp = xp(colvb, xx, yy, txt)

xx = 20200

txt = "66hr"

wp = xp(colvb, xx, yy, txt)

xx = 22000

txt = "72hr"

wp = xp(colvb, xx, yy, txt)

xx = 23800

txt = "78hr"

wp = xp(colvb, xx, yy, txt)

xx = 25600

txt = "84hr"

wp = xp(colvb, xx, yy, txt)

xx = 27400

txt = "90hr"

wp = xp(colvb, xx, yy, txt)

xx = 29200

txt = "96hr"

wp = xp(colvb, xx, yy, txt)

xx = 600

yy = 1850

txt = "100"

wp = xp(colvb, xx, yy, txt)

yy = 3350

xx = 11600

txt = "10"

wp = xp(colvb, xx, yy, txt)

xx = 700

yy = 4850

txt = "1"

wp = xp(colvb, xx, yy, txt)

xx = 600

yy = 6350

txt = "0.1"

wp = xp(colvb, xx, yy, txt)

xx = 22100

yy = 350

txt = "1000"

wp = xp(colvb, xx, yy, txt)

yy = 1850

txt = " 100"

wp = xp(colvb, xx, yy, txt)

yy = 3350

txt = " 10"

wp = xp(colvb, xx, yy, txt)

yy = 4850

txt = " 1"

wp = xp(colvb, xx, yy, txt)

yy = 6350

txt = " 0.1"

wp = xp(colvb, xx, yy, txt)

'画格

Picture1.ForeColor = vbWhite

Picture1.Line (450, 700)-(500, 700)

Picture1.Line (450, 1000)-(500, 1000)

Picture1.Line (450, 1300)-(500, 1300)

Picture1.Line (450, 1600)-(500, 1600)

Picture1.ForeColor = vbRed

Picture1.Line (500, 566.7)-(550, 566.7)

Picture1.Line (500, 733.3)-(550, 733.3)

Picture1.Line (500, 900)-(550, 900)

Picture1.Line (500, 1066.7)-(550, 1066.7)

Picture1.Line (500, 1233.3)-(550, 1233.3)

Picture1.Line (500, 1400)-(550, 1400)

Picture1.Line (500, 1566.7)-(550, 1566.7)

Picture1.Line (500, 1733.3)-(550, 1733.3)

Picture1.Line (500, 2066.7)-(550, 2066.7)

Picture1.Line (500, 2233.3)-(550, 2233.3)

Picture1.Line (500, 2400)-(550, 2400)

Picture1.Line (500, 2566.7)-(550, 2566.7)

Picture1.Line (500, 2733.3)-(550, 2733.3)

Picture1.Line (500, 2900)-(550, 2900)

Picture1.Line (500, 3066.7)-(550, 3066.7)

Picture1.Line (500, 3233.3)-(550, 3233.3)

Picture1.Line (500, 3566.7)-(550, 3566.7)

Picture1.Line (500, 3733.3)-(550, 3733.3)

Picture1.Line (500, 3900)-(550, 3900)

Picture1.Line (500, 4066.7)-(550, 4066.7)

Picture1.Line (500, 4233.3)-(550, 4233.3)

Picture1.Line (500, 4400)-(550, 4400)

Picture1.Line (500, 4566.7)-(550, 4566.7)

Picture1.Line (500, 4733.3)-(550, 4733.3)

Picture1.Line (500, 5066.7)-(550, 5066.7)

Picture1.Line (500, 5233.3)-(550, 5233.3)

Picture1.Line (500, 5400)-(550, 5400)

Picture1.Line (500, 5566.7)-(550, 5566.7)

Picture1.Line (500, 5733.3)-(550, 5733.3)

Picture1.Line (500, 5900)-(550, 5900)

Picture1.Line (500, 6066.7)-(550, 6066.7)

Picture1.Line (500, 6233.3)-(550, 6233.3)

Picture1.ForeColor = vbWhite

Picture1.Line (450, 400)-(27500, 400)

Picture1.Line (450, 1900)-(27500, 1900)

Picture1.Line (450, 3400)-(27500, 3400)

Picture1.Line (450, 4900)-(27500, 4900)

Picture1.Line (450, 6400)-(27500, 6400)

Picture1.Line (450, 2200)-(500, 2200)

Picture1.Line (450, 2500)-(500, 2500)

Picture1.Line (450, 2800)-(500, 2800)

Picture1.Line (450, 3100)-(500, 3100)

Picture1.Line (450, 3700)-(500, 3700)

Picture1.Line (450, 4000)-(500, 4000)

Picture1.Line (450, 4300)-(500, 4300)

Picture1.Line (450, 4600)-(500, 4600)

Picture1.Line (450, 5200)-(500, 5200)

Picture1.Line (450, 5500)-(500, 5500)

Picture1.Line (450, 5800)-(500, 5800)

Picture1.Line (450, 6100)-(500, 6100)

Picture1.Line (500, 400)-(500, 6400)

Picture1.Line (500 + 0, 400)-(500 + 0, 6400)

Picture1.Line (1400 + 0, 400)-(1400 + 0, 6400)

Picture1.Line (2300 + 0, 400)-(2300 + 0, 6400)

Picture1.Line (3200 + 0, 400)-(3200 + 0, 6400)

Picture1.Line (4100 + 0, 400)-(4100 + 0, 6400)

Picture1.Line (5000 + 0, 400)-(5000 + 0, 6400)

Picture1.Line (5900 + 0, 400)-(5900 + 0, 6400)

Picture1.Line (6800 + 0, 400)-(6800 + 0, 6400)

Picture1.Line (7700 + 0, 400)-(7700 + 0, 6400)

Picture1.Line (8600 + 0, 400)-(8600 + 0, 6400)

Picture1.Line (9500 + 0, 400)-(9500 + 0, 6400)

Picture1.Line (10400 + 0, 400)-(10400 + 0, 6400)

Picture1.Line (11300, 400)-(11300, 6400)

Picture1.Line (12200, 400)-(12200, 6400)

Picture1.Line (13100, 400)-(13100, 6400)

Picture1.Line (14000, 400)-(14000, 6400)

Picture1.Line (14900, 400)-(14900, 6400)

Picture1.Line (15800, 400)-(15800, 6400)

Picture1.Line (16700, 400)-(16700, 6400)

Picture1.Line (17600, 400)-(17600, 6400)

Picture1.Line (18500, 400)-(18500, 6400)

Picture1.Line (19400, 400)-(19400, 6400)

Picture1.Line (20300, 400)-(20300, 6400)

Picture1.Line (21200, 400)-(21200, 6400)

Picture1.Line (22100, 400)-(22100, 6400)

Picture1.Line (23000, 400)-(23000, 6400)

Picture1.Line (23900, 400)-(23900, 6400)

Picture1.Line (24800, 400)-(24800, 6400)

Picture1.Line (25700, 400)-(25700, 6400)

Picture1.Line (26600, 400)-(26600, 6400)

Picture1.Line (27500, 400)-(27500, 6400)

Picture1.Line (0 * 5 + 500, 3400 - b(0) * 30)-(c(1) * 5 + 500, 3400 - b(0) * 30), QBColor(12)

Picture1.Line (c(1) * 5 + 498, 3400 - b(1) * 30)-(c(2) * 5 + 502, 3400 - b(1) * 30), QBColor(12)

Picture1.Line (c(2) * 5 + 498, 3400 - b(2) * 30)-(c(3) * 5 + 502, 3400 - b(2) * 30), QBColor(12)

Picture1.Line (c(3) * 5 + 498, 3400 - b(3) * 30)-(c(4) * 5 + 502, 3400 - b(3) * 30), QBColor(12)

Picture1.Line (c(4) * 5 + 498, 3400 - b(4) * 30)-(c(5) * 5 + 502, 3400 - b(4) * 30), QBColor(12)

Picture1.Line (c(5) * 5 + 498, 3400 - b(5) * 30)-(c(6) * 5 + 502, 3400 - b(5) * 30), QBColor(12)

Picture1.Line (c(6) * 5 + 498, 3400 - b(6) * 30)-(c(7) * 5 + 502, 3400 - b(6) * 30), QBColor(12)

Picture1.Line (c(7) * 5 + 498, 3400 - b(7) * 30)-(c(8) * 5 + 502, 3400 - b(7) * 30), QBColor(12)

Picture1.Line (c(8) * 5 + 498, 3400 - b(8) * 30)-(c(9) * 5 + 502, 3400 - b(8) * 30), QBColor(12)

Picture1.Line (c(9) * 5 + 498, 3400 - b(9) * 30)-(c(10) * 5 + 502, 3400 - b(9) * 30), QBColor(12)

Picture1.Line (c(10) * 5 + 498, 3400 - b(10) * 30)-(c(11) * 5 + 502, 3400 - b(10) * 30), QBColor(12)

Picture1.Line (c(11) * 5 + 498, 3400 - b(11) * 30)-(c(12) * 5 + 502, 3400 - b(11) * 30), QBColor(12)

Picture1.Line (c(12) * 5 + 498, 3400 - b(12) * 30)-(c(13) * 5 + 502, 3400 - b(12) * 30), QBColor(12)

Picture1.Line (c(13) * 5 + 498, 3400 - b(13) * 30)-(c(14) * 5 + 502, 3400 - b(13) * 30), QBColor(12)

Picture1.Line (c(14) * 5 + 498, 3400 - b(14) * 30)-(c(15) * 5 + 502, 3400 - b(14) * 30), QBColor(12)

Picture1.Line (c(15) * 5 + 498, 3400 - b(15) * 30)-(c(16) * 5 + 502, 3400 - b(15) * 30), QBColor(12)

chaxun1 = "select * from jishijilu where gyh_riqi='" gongyi_sj(0) "-" record_rq "'order by shijian "

mdh = chaxun1

Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"

Adodc3.RecordSource = mdh

Adodc3.Refresh

zslNew = Adodc3.Recordset.RecordCount

Text4 = zslNew

If zslNew = 1 Then

Adodc3.Recordset.MoveFirst

For i = 0 To zslNew - 1

quexian(0, i) = Adodc3.Recordset(0)

For j = 2 To 7

quexian(j, i) = Adodc3.Recordset(j)

Next j

Adodc3.Recordset.MoveNext

Next i

Adodc3.Recordset.MoveFirst

For j = 0 To zslNew - 1

Picture1.Line (j * 5 + 500, quexian(2, j) * -30 + 3399)-(j * 5 + 500, quexian(2, j) * -30 + 3401), vbRed, BF

Picture1.Line (j * 5 + 500, quexian(3, j) * -30 + 3399)-(j * 5 + 500, quexian(3, j) * -30 + 3401), QBColor(7), BF

Picture1.Line (j * 5 + 500, quexian(4, j) * -30 + 3399)-(j * 5 + 500, quexian(4, j) * -30 + 3401), vbWhite, BF

Picture1.Line (j * 5 + 500, quexian(5, j) * -30 + 3399)-(j * 5 + 500, quexian(5, j) * -30 + 3401), vbYellow, BF

Picture1.Line (j * 5 + 500, quexian(6, j) * -30 + 3399)-(j * 5 + 500, quexian(6, j) * -30 + 3401), vbGreen, BF

If quexian(8, j) 1 Then

wy_wy = 0 + 166.7

br_br = 55

ElseIf quexian(8, j) = 1 And quexian(8, j) 10 Then

wy_wy = -1500 + 166.7

br_br = 5.5556

ElseIf quexian(8, j) = 10 And quexian(8, j) 100 Then

wy_wy = -3000 + 166.7

br_br = 0.5555

ElseIf quexian(8, j) = 100 And quexian(8, j) 1000 Then

wy_wy = -4500 + 166.7

br_br = 0.055555

End If

Picture1.Line (j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3397 + 3000)-(j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3403 + 3000), QBColor(11), BF

Next j

zslOld = zslNew

End If

zslOld = zslNew

End Sub

'通过计时器调用定时更新

Private Sub cmdRef_Click()

chaxun1 = "select * from jishijilu where gyh_riqi='" gongyi_sj(0) "-" record_rq "'order by shijian "

mdh = chaxun1

Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Ldgz\wd.mdb;Persist Security Info=False"

Adodc3.RecordSource = mdh

Adodc3.Refresh

zslNew = Adodc3.Recordset.RecordCount

Text4 = zslNew

If zslNew 1 Then

Adodc3.Recordset.MoveLast

For j = 2 To 7

quexian(j, i) = Adodc3.Recordset(j)

Next j

Picture2.Height = 10000

Picture1.Visible = True

If zslOld = 1 Then

For j = zslOld - 1 To zslNew - 1

Picture1.Line (j * 5 + 500, quexian(2, j) * -30 + 3399)-(j * 5 + 500, quexian(2, j) * -30 + 3401), vbRed, BF

Picture1.Line (j * 5 + 500, quexian(3, j) * -30 + 3399)-(j * 5 + 500, quexian(3, j) * -30 + 3401), QBColor(7), BF

Picture1.Line (j * 5 + 500, quexian(4, j) * -30 + 3399)-(j * 5 + 500, quexian(4, j) * -30 + 3401), vbWhite, BF

Picture1.Line (j * 5 + 500, quexian(5, j) * -30 + 3399)-(j * 5 + 500, quexian(5, j) * -30 + 3401), vbYellow, BF

Picture1.Line (j * 5 + 500, quexian(6, j) * -30 + 3399)-(j * 5 + 500, quexian(6, j) * -30 + 3401), vbGreen, BF

If quexian(8, j) 1 Then

wy_wy = 0 + 166.7

br_br = 55

ElseIf quexian(8, j) = 1 And quexian(8, j) 10 Then

wy_wy = -1500 + 166.7

br_br = 5.5556

ElseIf quexian(8, j) = 10 And quexian(8, j) 100 Then

wy_wy = -3000 + 166.7

br_br = 0.5555

ElseIf quexian(8, j) = 100 And quexian(8, j) 1000 Then

wy_wy = -4500 + 166.7

br_br = 0.055555

End If

Picture1.Line (j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3395 + 3000)-(j * 5 + 500, quexian(8, j) * br_br * -30 + wy_wy + 3405 + 3000), QBColor(11), BF

Next j

End If

'记录时间最长96小时

cmdPrint.Enabled = True

End If

zslOld = zslNew

End Sub

vbgps数据采集代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb采集plc数据、vbgps数据采集代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/7652.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载