mscomm,timer控件
在窗体内放置一个按钮,两个timer(interval不一样,timer1是50ms,timer2是1000ms),一个mscomm,用按钮控制timer.enabled的true,false,按钮部分代码如下:Timer1.Enabled = Not Timer1.Enabled
Timer2.Enabled = Not Timer2.Enabled
timer1:
MSComm1.Output = "#" + Dev_4118_1 + Chr(13)
Do
DoEvents
Dev_Output_1 = Dev_Output_1 & MSComm1.Input
Loop Until InStr(Dev_Output_1, vbCr)
Dev_Output_1 = Mid(Dev_Output_1, 3, Len(Dev_Output_1) - 2)
Dev_OutputArr_1 = Split(Dev_Output_1, "+")
timer2的代码:
MSComm1.Output = "#" + Dev_4117 + Chr(13)
Do
DoEvents
Dev_OutputV = Dev_OutputV & MSComm1.Input
Loop Until InStr(Dev_OutputV, vbCr)
'Dev_OutputV = Dev_OutputV & MSComm1.Input
Dev_OutputV = Mid(Dev_OutputV, 3, Len(Dev_OutputV) - 2)
Dev_OutputArrV = Split(Dev_OutputV, "+")
遇到的问题是:timer2的代码在运行,timer1的值dev_output_1就不再变了,是不是在MSComm1.Output = "#" + Dev_4118_1 + Chr(13),MSComm1.Output = "#" + Dev_4117 + Chr(13)这两句在一定时间内有冲突了?请告之,怎样去修改,谢谢 mscomm timer
补充:VB , 控件