主题:求助Vb时钟控制脉冲输出的问题
小弟还是新手,最近要编一个低频多路器的控制程序,要控制多路器输出脉冲信号,现在程序只能控制输出5V的ttl电平,问是不是输出脉冲需要时钟来控制,另外如何操作呢。下面是完整程序。
Private Sub Command12_Click()
Command12.Enabled = False
Text8.Text = 4
Text7.Text = 20
Text10.Text = 0
Text9.Text = 0
Text12.Text = 4
Text11.Text = 48
Command8_Click
'1
'300rpm + 5port
Text8.Text = 3
Text7.Text = 252
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 197
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 36
Text10.Text = 0
Text9.Text = 0
Text12.Text = 27
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 76
Text10.Text = 255
Text9.Text = 255
Text12.Text = 230
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 56
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 176
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'2
'300rpm + 5port
Text8.Text = 3
Text7.Text = 254
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 197
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 38
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 78
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 58
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 178
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'3
'300rpm + 3port
Text8.Text = 4
Text7.Text = 0
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 195
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 40
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 80
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 60
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 180
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'4
'300rpm + 3port
Text8.Text = 4
Text7.Text = 2
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 195
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 42
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 82
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 62
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'200rpm
Text8.Text = 4
Text7.Text = 182
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 200
Command8_Click
'nr.componenti vennice
Text8.Text = 3
Text7.Text = 250
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 4
Command8_Click
Text8.Text = 4
Text7.Text = 18
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 0
Command8_Click
'data valid
Text8.Text = 4
Text7.Text = 20
Text10.Text = 0
Text9.Text = 0
Text12.Text = 4
Text11.Text = 112
Command8_Click
'begin
Text8.Text = 4
Text7.Text = 18
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 1
Command8_Click
Command12.Enabled = True
End Sub
这是其中一个按键控件功能,感觉是用来控制步进电机的,如果是的话,其输出就是脉冲信号了,另外如果该程序无脉冲输出功能的话,用时钟该如何编呢,望大家指点迷津。
Private Sub Command12_Click()
Command12.Enabled = False
Text8.Text = 4
Text7.Text = 20
Text10.Text = 0
Text9.Text = 0
Text12.Text = 4
Text11.Text = 48
Command8_Click
'1
'300rpm + 5port
Text8.Text = 3
Text7.Text = 252
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 197
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 36
Text10.Text = 0
Text9.Text = 0
Text12.Text = 27
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 76
Text10.Text = 255
Text9.Text = 255
Text12.Text = 230
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 56
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 176
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'2
'300rpm + 5port
Text8.Text = 3
Text7.Text = 254
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 197
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 38
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 78
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 58
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 178
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'3
'300rpm + 3port
Text8.Text = 4
Text7.Text = 0
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 195
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 40
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 80
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 60
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'100rpm
Text8.Text = 4
Text7.Text = 180
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 100
Command8_Click
'4
'300rpm + 3port
Text8.Text = 4
Text7.Text = 2
Text10.Text = 0
Text9.Text = 0
Text12.Text = 18
Text11.Text = 195
Command8_Click
'6944steps
Text8.Text = 4
Text7.Text = 42
Text10.Text = 0
Text9.Text = 0
Text12.Text = 17
Text11.Text = 32
Command8_Click
'-27steps
Text8.Text = 4
Text7.Text = 82
Text10.Text = 255
Text9.Text = 255
Text12.Text = 200
Text11.Text = 0
Command8_Click
'3000ms
Text8.Text = 4
Text7.Text = 62
Text10.Text = 0
Text9.Text = 0
Text12.Text = 11
Text11.Text = 184
Command8_Click
'200rpm
Text8.Text = 4
Text7.Text = 182
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 200
Command8_Click
'nr.componenti vennice
Text8.Text = 3
Text7.Text = 250
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 4
Command8_Click
Text8.Text = 4
Text7.Text = 18
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 0
Command8_Click
'data valid
Text8.Text = 4
Text7.Text = 20
Text10.Text = 0
Text9.Text = 0
Text12.Text = 4
Text11.Text = 112
Command8_Click
'begin
Text8.Text = 4
Text7.Text = 18
Text10.Text = 0
Text9.Text = 0
Text12.Text = 0
Text11.Text = 1
Command8_Click
Command12.Enabled = True
End Sub
这是其中一个按键控件功能,感觉是用来控制步进电机的,如果是的话,其输出就是脉冲信号了,另外如果该程序无脉冲输出功能的话,用时钟该如何编呢,望大家指点迷津。