User`s manual
Writing Custom Applications
// Set test mode
Module.Input().TestEnable(Settings.TestCounterEnable);
// Set Decimation Factor
int factor = Settings.DecimationEnable ? Settings.DecimationFactor : 0;
Module.Input().Decimation(factor);
For test purposes, the FPGA firmware supports replacement of analog input samples with ascending ramp data. If the test
counter is enabled in the GUI, it is applied to the hardware using the preceding code fragment.
The logic has a decimation feature, where samples are discarded to reduce the sample rate. If used, all but one of every N
samples are discarded. If no decimation is desired, the default value of 1 should be used.
// All channels trigger together
Module.Input().ExternalTrigger((Settings.ExternalTrigger == 1));
Samples will not be acquired until the channels are triggered. Triggering may be initiated by a software command or via an
external input signal to the Trigger SMA connector. The code fragment above selects the trigger mode.
// Frame count in units of packet elements
if (Settings.Framed)
Module.Input().Framed(Settings.FrameCount);
else
Module.Input().Unframed();
The module supports framed triggering, where a single trigger enables many data samples to be taken before rechecking the
trigger. This code enables framed mode, or disables it depending on the settings.
enum IUsesX5Alerts::AlertType Alert[] = {
IUsesX5Alerts::alertTimeStampRollover, IUsesX5Alerts::alertSoftware,
IUsesX5Alerts::alertWarningTemperature,
IUsesX5Alerts::alertInputFifoOverrun,
IUsesX5Alerts::alertInputTrigger, IUsesX5Alerts::alertInputOverrange };
for (unsigned int i = 0; i < Settings.AlertEnable.size(); ++i)
Module.Alerts().AlertEnable(Alert[i], Settings.AlertEnable[i] ? true : false);
The fragment above enables alert generation by the module. The GUI control includes check boxes for each of the types of
alerts of which the module is capable. The enabled state of the check boxes is copied into the Settings.AlertEnable array.
This code fragment applies the state of each bit in that array to the Alerts() sub-object within the module. During streaming,
an alert message will be sent to the Host tagged with a special alert packet ID (PID), to signify the alert condition.
//
// Start Streaming
Stream.Start();
UI->Log("Stream Mode started");
UI->Status("Stream Mode started");
The Stream Start command applies all of the above configuration settings to the module, then enables PCI data flow. The
software timer is then started as well.
FTicks = 0;
Timer.Enabled(true);
}
X5-GSPS User's Manual 54