没有合适的资源?快使用搜索试试~ 我知道了~
MSComm读取电子称数据
5星 · 超过95%的资源 需积分: 10 52 下载量 55 浏览量
2011-11-14
22:30:16
上传
评论
收藏 2KB TXT 举报
温馨提示
试读
2页
从网上找到的关于MSComm读取电子称数据的文章,很实用!
资源推荐
资源详情
资源评论
Private Sub MSComm1_OnComm()
On Error Resume Next
recive = MSComm1.Input
For i = 0 To UBound(recive)
If begin = 0 Then
If recive(i) = 2 Then '找到开始标识2,设置标志为1
begin = 1
End If
Else
str_Date(int_Jishuqi) = recive(i)
int_Jishuqi = int_Jishuqi + 1 '计数器
If int_Jishuqi > 16 Then '数组下标默认从0开始,,0-16共17个字节的数
begin = 0
int_Jishuqi = 0
If str_Date(1) Mod 3 = 0 Then '
a = CStr(Chr(str_Date(3))) & CStr(Chr(str_Date(4))) & CStr(Chr(str_Date(5))) & CStr(Chr(str_Date(6))) & CStr(Chr(str_Date(7))) & CStr(Chr(str_Date(8)))
If a > 80000 And a < 110000 Then
a1 = a
Text2.Text = CDbl(Round(a1 / 1000, 1))
End If
If a < 80000 And a > 50000 Then
a2 = a
Text3.Text = CDbl(Round(a2 / 1000, 1))
Text4.Text = ((Text2.Text) - (Text3.Text))
a3 = CStr(Text4.Text)
On Error Resume Next
recive = MSComm1.Input
For i = 0 To UBound(recive)
If begin = 0 Then
If recive(i) = 2 Then '找到开始标识2,设置标志为1
begin = 1
End If
Else
str_Date(int_Jishuqi) = recive(i)
int_Jishuqi = int_Jishuqi + 1 '计数器
If int_Jishuqi > 16 Then '数组下标默认从0开始,,0-16共17个字节的数
begin = 0
int_Jishuqi = 0
If str_Date(1) Mod 3 = 0 Then '
a = CStr(Chr(str_Date(3))) & CStr(Chr(str_Date(4))) & CStr(Chr(str_Date(5))) & CStr(Chr(str_Date(6))) & CStr(Chr(str_Date(7))) & CStr(Chr(str_Date(8)))
If a > 80000 And a < 110000 Then
a1 = a
Text2.Text = CDbl(Round(a1 / 1000, 1))
End If
If a < 80000 And a > 50000 Then
a2 = a
Text3.Text = CDbl(Round(a2 / 1000, 1))
Text4.Text = ((Text2.Text) - (Text3.Text))
a3 = CStr(Text4.Text)
资源评论
- XianSunRain2014-07-08对我没什么用
- DBGRIDEH2016-05-30最近有需要称重方面的知识,,有帮助...
- ccccht2014-04-27学习参考下,txt
sily_2002
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功