📄 daqmx dig write.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 3 'Fixed Dialog
Caption = "DAQmx Write to Digital Lines"
ClientHeight = 2685
ClientLeft = 45
ClientTop = 435
ClientWidth = 4365
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2685
ScaleWidth = 4365
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txtChannelString
Height = 375
Left = 1080
TabIndex = 1
Text = "Dev1/port0/line0:7"
Top = 720
Width = 2535
End
Begin VB.CommandButton Command1
Caption = "Write to digital lines"
Height = 615
Left = 1080
TabIndex = 0
Top = 1440
Width = 2055
End
Begin VB.Label Label1
Caption = "Channel String:"
Height = 495
Left = 360
TabIndex = 2
Top = 720
Width = 615
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim sampsPerChanWritten As Long
Dim taskHandle As Long
' Write zeros or ones to the digital lines
Dim i As Integer
Dim writeArray(0 To 7) As Byte
For i = 0 To 7
writeArray(i) = 1
Next
' Create the DAQmx task.
DAQmxErrChk DAQmxCreateTask("", taskHandle)
' Add a digital output channel to the task.
DAQmxErrChk DAQmxCreateDOChan(taskHandle, txtChannelString.Text, "", DAQmx_Val_ChanForAllLines)
' Start the task running, and write to the digital lines.
DAQmxErrChk DAQmxStartTask(taskHandle)
DAQmxErrChk DAQmxWriteDigitalLines(taskHandle, 1, 1, 10#, DAQmx_Val_GroupByChannel, writeArray(0), sampsPerChanWritten, 0)
MsgBox "Samples per channel written = " & sampsPerChanWritten
' All done!
DAQmxErrChk DAQmxStopTask(taskHandle)
DAQmxErrChk DAQmxClearTask(taskHandle)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -