03-03-2009 12:58 PM
I have contacted with NI technical support, but did not resolve it. So try to publish here for sooner solution. my reference number is Reference#1338119.
The problem we met is about using the code to implement analogy trigger for PCI 5105, but it does not work in measurement studio. We want to know the trigger source for analogy trigger in function, even we succeed in digitial trigger for this card.
The command we used in our codes is:
GetSignalTask.Triggers.StartTrigger.ConfigureAnalogEdgeTrigger("CH1", AnalogEdgeStartTriggerSlope.Rising, 2.5)
The message windows shows us as follows,
Measurements: specified property is not supported by the device or is not applicable to the task.
Property: NationalInstruments.DAQmx.AnalogEdgeStartTrigger.Source
Task Name: _unnameTask<2>
Status Code: -200452
It seems a bit wired since we have something worng in the trigger source. Is this correct to use channel 1: CH1?
PS. the codes
Private Sub MenuItem_Start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem_Start.Click
If acquiring Then
Return
End If
count = 0
'continue mode
If Config.Mode = 0 Then
samples = Config.Periods * Config.sampleRate / Config.ScanFrequency
Else 'trigger mode
samples = 2 * Config.sampleRate / Config.ScanFrequency
End If
Try
GetSignalTask = New Task
GetSignalTask.AIChannels.CreateVoltageChannel(Config.PhysicalChannel, "Voltage1", _
CType(-1, AITerminalConfiguration), Convert.ToDouble(-10), _
Convert.ToDouble(10), AIVoltageUnits.Volts)
GetSignalTask.Timing.ConfigureSampleClock("", Config.sampleRate, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, samples)
'GetSignalTask.Triggers.StartTrigger.ConfigureDigitalEdgeTrigger("PFI1", DigitalEdgeStartTriggerEdge.Falling)
GetSignalTask.Triggers.StartTrigger.ConfigureAnalogEdgeTrigger("CH1", AnalogEdgeStartTriggerSlope.Rising, 2.5)
GetSignalTask.Control(TaskAction.Verify)
GetSignalTask.Stream.Timeout = -1
reader = New AnalogSingleChannelReader(GetSignalTask.Stream)
#If NETFX2_0 Then
reader.SynchronizeCallbacks = True
#Else
reader.SynchronizingObject = Me
#End If
acquiring = True
StatusBar.Text = "Running..."
ToolBarButton3.Pushed = True
analogCallback = New AsyncCallback(AddressOf AnalogInCallback)
reader.BeginReadMultiSample(samples, analogCallback, Nothing)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
03-04-2009 10:49 AM
Fox,
We do have a very good introduction to using VB.NET with the NI-Scope drivers. It seems to me like you are trying to use DAQmx function calls with the PCI-5105 and the DAQmx driver will not work for the 5105 which is why you are getting the errors that you listed. Please make sure that you have the NI-Scope Driver and have VB.Net support for Visual Studio and Measurement Studio installed as well as the NI-Scope .NET Class Library. You will need both of these items to successfully use the NI-Scope driver with your 5105. I would also look at the VB.NET NI-SCOPE--Getting Started. If you download the Zip file that is on the Getting Started page you will notice that there is a niScope.vb file which lists off all of the functions for VB that the driver supports. The one I believe you are looking for is "ConfigureTriggerEdge", this will allow you to configure your analog edge trigger. Details on the function are listed below.
'''''<summary>
'''''Configures common properties for analog edge triggering. An edge trigger occurs when the trigger signal passes through the voltage threshold that you specify with the Trigger Level parameter and has the slope that you specify with the Trigger Slope parameter.
'''''
'''''When you initiate an acquisition, the digitizer waits for the start trigger, which is configured through the NISCOPE_ATTR_ACQ_ARM_SOURCE (Start Trigger Source) attribute. The default is immediate. Upon receiving the start trigger the digitizer begins sampling pretrigger points. After the digitizer finishes sampling pretrigger points, the digitizer waits for a reference (stop) trigger that you specify with a function such as this one. Upon receiving the reference trigger the digitizer finishes the acquisition after completing posttrigger sampling. With each Configure Trigger function, you specify configuration parameters such as the trigger source and the amount of trigger delay.
'''''
'''''
'''''</summary>
'''''<param name="Instrument_Handle">
'''''The Instrument Handle that you obtain from niScope_init. The handle identifies a particular instrument's session.
'''''</param>
'''''<param name="Trigger_Source">
'''''The trigger source; NI-SCOPE uses this value to set NISCOPE_ATTR_TRIGGER_SOURCE.
'''''</param>
'''''<param name="Level">
'''''The voltage threshold for the trigger; NI-SCOPE uses this value to set NISCOPE_ATTR_TRIGGER_LEVEL.
'''''</param>
'''''<param name="Slope">
'''''Specifies whether you want a rising edge or a falling edge to trigger the digitizer Refer to NISCOPE_ATTR_TRIGGER_SLOPE for the defined values.
'''''</param>
'''''<param name="Trigger_Coupling">
'''''Applies coupling and filtering options to the trigger signal; NI-SCOPE uses this value to set NISCOPE_ATTR_TRIGGER_COUPLING.
'''''</param>
'''''<param name="Holdoff">
'''''The length of time the digitizer waits after detecting a trigger before enabling NI-SCOPE to detect another trigger; the units are seconds; NI-SCOPE uses this value to set NISCOPE_ATTR_TRIGGER_HOLDOFF.
'''''</param>
'''''<param name="Delay">
'''''The length of time (in seconds) the digitizer waits after it receives the trigger to start acquiring data. NI-SCOPE uses this value to set NISCOPE_ATTR_TRIGGER_DELAY_TIME.
'''''
'''''</param>
'''''<returns>
'''''Returns the status of the function.
'''''
'''''To obtain a text description of the status code call niScope_errorHandler.
'''''</returns>
Public Function ConfigureTriggerEdge(ByVal Trigger_Source As String, ByVal Level As Double, ByVal Slope As Integer, ByVal Trigger_Coupling As Integer, ByVal Holdoff As Double, ByVal Delay As Double) As Integer
Dim pInvokeResult As Integer = PInvoke.ConfigureTriggerEdge(Me._handle, Trigger_Source, Level, Slope, Trigger_Coupling, Holdoff, Delay)
PInvoke.TestForError(Me._handle, pInvokeResult)
Return pInvokeResult
End Function