Signal Generators

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I route the software trigger signal out of the 5412

I am programming with visual basic. How can I route the software trigger signal out of the 5412 in vb?
I have tried using the niFgen_RouteSignalOut Function. But it didn't work.

These are the code segments:

CheckError (niFgen_init("Dev1", True, True, handle))
CheckError (niFgen_AbortGeneration(handle))
CheckError (niFgen_ConfigureOutputMode(handle, NIFGEN_VAL_OUTPUT_ARB))
CheckError (niFgen_AbortGeneration(handle))
CheckError (niFgen_ClearArbMemory(handle))
CheckError (niFgen_ConfigureClockMode(handle, NIFGEN_VAL_HIGH_RESOLUTION))
CheckError (niFgen_ConfigureTriggerMode(handle, 0, NIFGEN_VAL_STEPPED))
CheckError (niFgen_ConfigureTriggerSource(handle, 0, NIFGEN_VAL_SOFTWARE_TRIG))
CheckError (niFgen_CreateBinary16ArbWaveform(handle, wavesize, Waveformdataarray(1), waveformhandle))
CheckError (niFgen_RouteSignalOut(handle, 0, NIFGEN_VAL_MARKER, NIFGEN_VAL_PFI_1))
CheckError (niFgen_ConfigureArbWaveform(handle, "0", waveformhandle, dblamp, 0))
CheckError (niFgen_ConfigureSampleRate(handle, dblSampleRate))
CheckError (niFgen_ConfigureOutputEnabled(handle, "0", True))
CheckError (niFgen_InitiateGeneration(handle))
For ii = 1 To 10
  CheckError (niFgen_SendSoftwareTrigger(handle))
  Waiting (1000)
Next ii
0 Kudos
Message 1 of 4
(7,102 Views)
 
Hi little_denny
 
The attached zip file contains an example I modified slightly from the niFgen arbitrary waveform example for VB.
In looking at that, I realized we have an error with our VB support.  The constants for NIFGEN_VAL_PFI_x are off by one.  So, your code wasn’t actually routing a signal to PFI1.  It was actually going to PFI0.
 
Also, selecting Marker as the signal to route isn’t correct either, but I assume you were trying different options to get this to work.
 
As another issue, which corrects the issue of the constants being off by one, is that they are now obsolete as niFgen 2.4.  Two of the functions you trying to use are also obsolete.  Although they will still work at this point.
 
The example shows the old functions commented out, followed by the new functions in doing what you are trying to do?
 
You can get the newest released version of NIFGen here:
https://www.ni.com/en/support/downloads/drivers/download.ni-fgen.html
 
Jerry
Message 2 of 4
(7,088 Views)
Thank you very much, Jerry. I have tried to observe the output of PFI0.
But there is a new question. When I set the software trigger parametre in the function routesignalout, an error will occur.
Could you tell me why?
0 Kudos
Message 3 of 4
(7,085 Views)
Hi little_denny
 
Software trigger is not a valid attribute for the Route Signal Function and this module.
 
The example I provided should do exactly as you asked for.  Every time the Software trigger function is called, the module generates a pulse on PFI0.
 
Jerry
0 Kudos
Message 4 of 4
(7,078 Views)