发表于:2004-11-14 14:00:00
楼主
各位高手,我有电子天平一个,想用VB写程序控制他,怎么实现不了呢?
天平的各项参数如下:
串口通讯协议:
波特率:600;数据位:8位;起始位:1位;停止位:1位
数据格式:
起始空格:2位;数据7位;符号:3位;停止:1位;回车:1位
校验:无
输出引角内容:2--RXD 3--TXD 5--GND 6,8为外接作命令打印键
计算机可以通过RS232与其通讯,计算机下达命令有:
1BH+70H 发送数据
1BH+71H 校准
1BH+72H 计数
1BH+73H 清零
我的程序是这样的,各位看看是怎么回事,请各位帮帮忙,
我的邮箱xiafei110@sina.com:
Private Sub Command1_Click()
MSComm1.settings = "600,n,8,1"
MSComm1.PortOpen = True
End Sub
Private Sub Command2_Click()
MSComm1.PortOpen = False
End Sub
Private Sub Command3_Click()
MSComm1.Output = "1BH+71H"
End Sub
Private Sub Command4_Click()
MSComm1.Output = "1BH+71H"
End Sub
Private Sub Command5_Click()
MSComm1.Output = "1BH+72H"
End Sub
Private Sub Command6_Click()
MSComm1.Output = "1BH+73H"
End Sub
Private Sub Command7_Click()
MSComm1.Output = "1BH+74H"
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvCD
Case comEvCTS
Case comEvDSR
Case comEvRing
Text1.Text = Trim(MSComm1.Output)
Case comEvSend
End Select
End Sub