Hope you'll bare with me on a few newbie questions:
I have ~100 solenoids I want to control using three PXI-2521 40-DPST switch modules. These solenoids will be controlled individually, and need to be activated for varying amounts of time (10-1000mS, typically). I have a PXI-5402 function generator that I have set up to generate a single pulse of a square weave using the frequency list method, and can very that pulse width from 10-1000mS as desired.
To feed that signal back into the switch modules, I figured the best way is to use one of the internal PXI bus channels, to route a trigger signal to the appropriate channel(s) for the solenoid I want to control. However, this is proving a bit more difficult than I would have imagined.
I *think* what I want to do is create a marker event, and then do an ExportSignal to route that marker event to the appropriate switch module. But the marker event doesn't exactly correspond to the generated waveform; it lags behind at least a clock cycle (which may be OK, but ideally I'd want the actual waveform output there).
Am I on the right path? Is there a much easier way to do what I describe? Why do I have this sinking feeling that I likely could have accomplished this programatically by simply varying the debounce time in the switch? Lastly, are there any examples in .NET (VB specifically) that might help with this?
It sounds like you are on the right track with the marker events controlling your switching. Since you are varying in pulse width for your different solenoids, you need something hardware timed (like the marker event) to control the switch. Something that can decrease the delay of your trigger signal is physically placing the cards next to each other or as close possible in your chassis. This will help reduce the propagation delay of your signal across the backplane.
This article has a lot of different VB .Net examples for NI-FGEN that you can find in the related links section.
Thanks for your reply. Unfortunately, none of the examples here seem to show how to actually create a marker event in VB. Any chance you have any such examples? I think *after* I create the marker, I can export it to the trigger bus as such:
niFgen.ExportSignal(niFgenConstants.MarkerEvent, 1, niFgenConstants.Rtsi0)
But I'm struggled with the syntax to actually set up this marker event (i.e., specify width, polarity, initial state, etc.). I don't see any functions in niFGEN.vb that seem to relate to this.
Note, I have reviewed the niFGen Properties doc (http://zone.ni.com/reference/en-XX/help/370524R-01/nifgenpropref/cnifgen/), so I am familiar with the params that can be varied, it's just not clear to me how they are set.
Hi jvara try the following configuration out for creating a marker event in VB.
niFGen.SetInt32(InstrumentDriverInterop.Ivi.niFgenProperties.ArbMarkerPosition, 0) -> Specifies on which sample the marker should be generated
niFGen.SetString(InstrumentDriverInterop.Ivi.niFgenProperties.MarkerEventOutputTerminal, "PFI0") -> Specifies which terminal to export the marker to
Give this a try and let me know how it goes.
> I have a PXI-5402 function generator
I thought marker events are only configurable in Arbitrary Waveform Generators (i.e PXI 5421) not on Function Generators. Maybe you meant Data Marker Event where you can route an individual bit from the data going into the main DAC on the device?
If that's the case, beware of Square Waves on 5402, because the data fed to the DAQ is actually that of a Sine Wave, and then the output of the DAC is passed through a hardware comparator to generate the final square wave. This is done in order to minimize jitter. As long as you route the most significant bit (the sign bit) you should be ok.
Hope this helps!
Just got back to this; having an issue. Here is my current code for the generator. Again, I'm trying to output a data marker event on the PXI interrupt bus, and route it to a switch so I can control a linear actuator connected to the switch.
'Create marker event to export
'Specify terminal to output event on
'Export signal on trigger bus
I am having trouble with the last line: I get an error message saying "Unknown channel or repeated capability name". According to NI-MAX, "PXI_Trig0" is a valid route for the PXI-5402, so I don't understand the error.
Any help is appreciated!
Thanks for the reply. Any more info on HOW to route the sign bit?
You need to configure two attributes:
I don't have the exact C# API names handy. Depending on the frequency, you may have some jitter as the device always pumps data to the DAC at 100 MS/s regardless of Sample Rate.
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: