串口數據存儲
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碼),按照通訊規約進行解析,解析輸出所需的數據;然後是數據存儲,這個過程就是一個數據入庫過程,與是否串口接收沒有大的關系,編寫連接資料庫代碼,寫入資料庫即可;最後,由於串口接收數據是實時通訊,而數據的解析和寫庫需要時間,程序的時序應安排好,防止數據解析和寫庫時間過長造成數據丟失。