niHSDIO_SetNamedWaveformNextWritePosition
Specific Function
C Function Prototype
ViStatus niHSDIO_SetNamedWaveformNextWritePosition (ViSession vi, ViConstString waveformName, ViInt32 position, ViInt32 offset);
Purpose
Modifies where within a named waveform to next write data. Write named waveform functions always begins writing at the current write position. Existing data in the waveform is overwritten.
The position and offset parameters are used together to determine the next write position. position describes an absolute (NIHSDIO_VAL_START_OF_WAVEFORM) or relative (NIHSDIO_VAL_CURRENT_READ_POSITION) move. offset is the number of samples to shift the next write position. You must always set the write position at a position that is a multiple of 32 samples for the NI 654x/655x devices or 64 samples for the NI 656x devices (128 samples if the NI 656x is in DDR mode).
Examples of combinations of position and offset
Position: NIHSDIO_VAL_START_OF_WAVEFORM
Offset: 0
Effect: Write location becomes the start of waveform.
Position: NIHSDIO_VAL_START_OF_WAVEFORM
Offset: 5
Effect: Write location becomes the sixth sample in waveform.
Position: NIHSDIO_VAL_START_OF_WAVEFORM
Offset: -1
Effect: ERROR—The device would try to place the write position before start of waveform.
Position: NIHSDIO_VAL_CURRENT_READ_POSITION
Offset: 0
Effect: No effect—leaves next write position unchanged.
Position: NIHSDIO_VAL_CURRENT_POSITION
Offset: 10
Effect: Shift write position 10 samples ahead from current write location. This position setting is only valid if the current write position plus this offset is in the waveform.
Position: NIHSDIO_VAL_CURRENT_POSITION
Offset: -10
Effect: Shift write position 10 samples back from current location. This position setting is only valid if the current write position is greater than 10.
The write position is moved to the end of the most recently written data after each call to niHSDIO_WriteNamedWaveformU32. Thus you do not need to explicitly call niHSDIO_SetNamedWaveformNextWritePosition unless you want to.
Attempting to set the write position past the end of the allocated space results in an error.
Parameters
Name | Type | Description |
---|---|---|
vi | ViSession | This handle identifies your instrument session. vi was obtained from the niHSDIO_InitAcquisitionSession or niHSDIO_InitGenerationSession function. |
waveformName | ViConstString | Specifies a string representing the name to associate with the allocated waveform memory. Default Value: "" |
position | ViInt32 | Specifies where to place the write position (in conjunction with offset): Defined Values NIHSDIO_VAL_START_OF_WAVEFORM (44)—Offset is relative to the beginning of the waveform. NIHSDIO_VAL_CURRENT_POSITION (45)—Offset is relative to the current write position in the waveform. Default Value: NIHSDIO_VAL_CURRENT_POSITION |
offset | ViInt32 | Specifies the write position of the name waveform in conjunction with the mode attribute. offset is in samples. Default Value: 0 |