串口数据存储
sql语句拼接有误;修改如下试试
……
stringsql="insertintoserialport_received("+rec+")values(@v)";
SqlCommandcmd=newSqlCommand(sql,conn);
SqlParameterparn=newSqlParameter("@v",txtReceive.Text.ToString());
cmd.Parameters.Add(parn);
……
⑵ 海量RS232/485串口数据采集存储(备份)解决方案
RS232/485串口转SD卡数据存储器是一种超大容量的数据存储设备。采用嵌入式系统控制芯片,将串口RS232/485输入的数据透明存储在SD卡中。该数据存储器采用模块化设计,不需要用户对现有设备进行改造,实现数据实时存储。可内置锂电池,独立工作于工业现场,将采集到的重要数据进行备份或移动存储。为众多系统集成商、自动化公司和研究所采用,是一种具有极高性价比、稳定可靠的数据存储产品
采用工业级ARM系列32位高性能嵌入式处理器,速度更快,更稳定;采用工业级ARM系列32位高性能嵌入式处理器,速度更快,更稳定;串口数据包全透明1:1真实存储 ;串口数据100%可靠存储;采用独特的动态内存分配算法,以此管理文件系统对内存的消耗和释放,提高数据的传输效率,避免数据丢失;数据存储文件自动创建文件名,自动编号,不重复覆盖;文件夹名称自定义,方便用户管理;支持定时创建数据存储文件(默认24个小时创建一个新的数据存储文件)进行存储,有利于对数据进行更有效的管理,更好的分析处理;具有USB拷贝数据功能,U盘式管理,高速USB2.0接口;更多资料网络,乐诚科技,便携式数据存储器。
⑶ 串口接收数据怎样存储在数组中呢
Dim Buffer as Variant 表示声明了一个Buffer变量,但是这个Buffer变量的类型不确定,可以是Long、Integer、Double、Object、String以及数组等等,Buffer变量的类型由编译器自行判断与转换。
Dim Buffer(100) as Variant 表示声明了一个数组Buffer,该数组有100个成员,数组的每一个成员都没有指定具体的数据类型,由编译器自行判断与转换
Dim receive(100) as Byte 表示声明了一个数组receive,该数组有100个成员,数组的每一个成员都是Byte型。
Dim Buffer() as Byte 表示声明了一个数组Buffer,该数组成员数目未知,数组的每一个成员都是Byte型。在确定数组成员数量之前是不能通过Buffer(xx)的这种方式访问Buffer里的成员的。
Dim Buffer() as Byte
.......
'接受
........
Buffer = Mscomm.Input
这种方法实际上是把Mscomm接收缓存里的所有数据读出来并保存到Buffer数组中,Buffer数组的大小由Mscomm接收缓存实际缓存的数据量决定,因为Mscomm的接收缓存里实际的数据量是不确定的,所以不能使用
Dim Receive(100) as Byte
.......
接受数据
Receive = Mscomm.Input
这样的方式。
Dim Receive(100) as Byte
.......
接受数据
Receive(i) = Mscomm.Input
这样是可以的,这样实际上是一次从Mscomm的接收缓存里读一个字节的数据,你这样做不行估计是因为数据传输速率和RThreshold设定的问题,因为赋值语句运行的时间要远比串口传输速率快很多倍,所以你必须等Mscomm的接收缓存里有100个字节以上的数据时你才能通过循环用Mscomm.Input依次读出100个字节的数据,否则就肯定会出错,所以如果你把RThreshold设定为100,也就是每收到100个字节的数据触发一次OnComm事件就可以通过Receive(i) = Mscomm.Input把数据读出来。
⑷ 串口发送给单片机的数据的存储格式是怎样的
串口发送给单片机的数据的存储在SBUF中,格式是高位在前。比如说发送1或十六进制数0x01,到单片机后,在SBUF中的存储格式是:
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 0 0 1
⑸ 串口数据的实时自动保存【VB】
有两部分程序需要编
一个是定时器,要在到2分钟的时候,读取串口的缓冲,然后保存文件。
另一个是串口编程,一个是要初始化一下,定义好串口的速率格式,然后把数据放在一个缓冲中
⑹ 串口接收数据怎样存储在数组中
可以加一个整数索引,对加入的数据长度进行标识。更好的是对这个数据进行扩展,变成一个堆栈,对其进行操作。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include<stdio.h>
#include<string.h>
#define byte unsigned char
byte queue_buf[20], idx = 0;
void push(byte n) //当串口每接收一个数据,就用push添加一个数据
{
if (idx < 20)
queue_buf[idx++] = n;
}
byte pop()
{
byte ret = 0;
if (idx-- > 0)
{
ret = queue_buf[0];
memcpy(queue_buf, &queue_buf[1], idx);
}
return ret;
}
byte size()
{
return idx;
}
byte clear()
{
memset(queue_buf, 0, 20);
idx = 0;
}
⑺ 关于串口通信数据的保存
实时采集的数据可直接用来画曲线,但往往为了以后查询,同时应按定时间隔写入数据库或文本文件。所以可在写入数据库后通过查询做到实时显示和更新。
'窗体加载时将已记录的数据查询后绘图
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
⑻ 怎样将串口接收到的数据存到数据库中
这是两个步骤的内容。首先是通讯,将串口接收的数据(十六进制数或ASCII码),按照通讯规约进行解析,解析输出所需的数据;然后是数据存储,这个过程就是一个数据入库过程,与是否串口接收没有大的关系,编写连接数据库代码,写入数据库即可;最后,由于串口接收数据是实时通讯,而数据的解析和写库需要时间,程序的时序应安排好,防止数据解析和写库时间过长造成数据丢失。