NI-FGEN
Programming State Model
In this topic the word "property," when not referring to a specific property, refers to both properties in LabVIEW and attributes in C or CVI.
The NI-FGEN programming model has three main states: Idle, Committed, and Generating, as shown in the following figure.
Idle–You can program all session properties in the Idle state. However, when in the Idle state, the properties may not have been applied to the device yet, so the device hardware configuration may not match the session property values–the device remains configured as it was the last time a session was committed. If the computer has just been reset or the niFgen Reset Device VI or the niFgen_ResetDevice function has just been called, the device is in the default hardware state. This means the device is not generating a waveform, although, depending on the previous state, a constant DC voltage from the last waveform sample generated on the output connector may be present.
Committed–All of the session properties are applied to the device when the session enters the Committed state. In the Committed state, waveforms and sequences can be loaded into onboard memory. If any properties are changed, the session implicitly transitions back to idle, and the hardware configuration still reflects the previously committed properties. Calling the niFgen Commit VI or the niFgen_Commit function from the Idle state verifies all properties, configures the device, and transitions to the Committed state.
Generating–In the Generating state, session properties always reflect the current state of the device, and the device is either waiting on a trigger or generating a signal. Dynamic properties, such as the Arbitrary Waveform Gain property or the NIFGEN_ATTR_ARB_GAIN attribute and the Arbitrary Waveform Offset property or the NIFGEN_ATTR_ARB_OFFSET attribute, are applied to the device immediately if set while the session is in the Generating state.
The following actions or settings cause a transition from one state to another:
- Calling the niFgen Initiate Generation VI or the niFgen_InitiateGeneration function in the Idle state causes a transition to the Generating state.
- Calling the niFgen Commit VI or the niFgen_Commit function in the Idle state causes a transition to the Committed state.
- Calling the any create or write waveform VI or function in the Idle state causes a transition to the Committed state.
- Calling the niFgen Create Arbitrary Sequence VI or the niFgen_CreateArbSequencee function, or the niFgen Create Advanced Arb Sequence VI or the niFgen_CreateAdvancedArbSequence function in the Idle state causes a transition to the Committed state.
- Changing any property in the Committed state causes a transition to the Idle state.
- Changing a property that is not dynamic in the Generating state returns an error, but does not transition out of the Generating state.
- Calling the niFgen Abort Generation VI or the niFgen_AbortGeneration function in the Generating state causes a transition to the Committed state.
- Calling the niFgen Close VI or the niFgen_close function from any state closes the NI-FGEN session and transitions to the close state. If the session is in the Generating state, the generation is aborted first.
- Calling the niFgen Reset VI or the niFgen_reset function from any state causes a transition to the Idle state. If the session is in the Generating state, the generation is aborted first.