From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

Route Waveform (Single-Shot Square Wave) As Trigger to Switch Module

Here is all of that section of code for reference. I modified one of the FGen examples; the function generate part is working fine. But I'm still struggling on how to route this marker to the switch. 

 

        Try
            'Construct the FGEN object
            niFGen = New InstrumentDriverInterop.Ivi.niFgen(txtResourceName.Text, True, True)
            'Flag that the object has been constructed
            constructed = True
            'Set the output mode to frequency list
            niFGen.ConfigureOutputMode(InstrumentDriverInterop.Ivi.niFgenConstants.OutputFreqList)
            'Create the frequency list and obtain the handle
            niFGen.CreateFreqList(niFgenConstants.WfmSquare, 1, pulseFreqArr, pulseWidthArr, frequencyListHandle)
            'Configure frequency list
            niFGen.ConfigureFreqList(txtChannel.Text, frequencyListHandle, Amplitude, 0, 0)
            'Set trigger mode to single to output only one waveform
            niFGen.ConfigureTriggerMode(txtChannel.Text, niFgenConstants.[Single])
            'Enable output on the specified channel
            niFGen.ConfigureOutputEnabled(txtChannel.Text, True)
            'Specifies terminal to output marker on
            niFGen.SetString(niFgenProperties.MarkerEventOutputTerminal, "PXI_Trig0")
            'Create marker event to export, specifies bit to generate marker on
            niFGen.SetInt32(niFgenProperties.DataMarkerEventDataBitNumber, 0)
            'Enable output on the PXI trigger bus
            niFGen.ExportSignal(niFgenConstants.DataMarkerEvent, 1, "PXI_Trig0")
            'Set switch trigger input to PXI trigger bus
            niSwitch.SetString(niSwitchProperties.TriggerInput, "PXI_Trig0")
            'Set polarity for trigger input to switch
            niSwitch.SetString(niSwitchProperties.TriggerInputPolarity, "RisingEdge")
            'Start generation
            niFGen.InitiateGeneration()

        Catch ex As Exception
            'If error occurs show it in the box on the form
            MsgBox(ex.Message)
0 Kudos
Message 11 of 13
(2,775 Views)

Marcos,

Having some trouble with the Data Marker Event Data bit set. No matter what value I specify for the data marker, I get the following error at runtime:

 

Unknown channel or repeated capability name. 0/0_datamarker0

 

I know this exception can occur if the output terminal isn't specified, but I definitely name it first: 

 

SetString(niFgenProperties.MarkerEventOutputTerminal, "PXI_Trig0") 

SetInt32(niFgenProperties.DataMarkerEventDataBitNumber, 0)

 

 

Any thoughts?

 

Thanks!

 

 
Marcos Kirsch
Chief Software Engineer
NI Driver Software
0 Kudos
Message 12 of 13
(2,770 Views)

Part of my issue is I'm not sure where exactly my code may be wrong. It would be helpful for troubleshooting if I could view what (if anything) is actually getting generated on the PXI trigger bus (PXI_Trig0 in my case). Is it possible to see the state of this bus anywhere? 

0 Kudos
Message 13 of 13
(2,762 Views)