2 #include "OutputsDAQmxLineClock.h"
3 #include "parameters/IO.h"
4 #include "parameters/Scope.h"
5 #include "helpers/ScopeException.h"
11 , XTotalPixels(_params.areas[area]->Currentframe().XTotalPixels())
12 , YTotalLines(_params.areas[area]->Currentframe().YTotalLines()) {
19 double pixelrate = 1/(_params.
areas[
area]->daq.pixeltime()*1E-6);
24 if ( DaqTimingHelper::Mode::ReferenceClock ==_outputparams.
pixel_timing() )
48 if ( DaqTimingHelper::Mode::ReferenceClock ==_outputparams.
line_timing() )
65 OutputsDAQmxLineClock::~OutputsDAQmxLineClock(
void) {
86 int32_t lastyblocksize = yblocksize + (
YTotalLines - yblocksize*_blocks);
90 DBOUT(L
"OutputsDAQmxLineClock::Write writeabort");
99 for ( uint32_t b = 0 ; b < _blocks ; b++ ) {
101 DBOUT(L
"OutputsDAQmxLineClock::Write writeabort");
107 , ((b==_blocks-1)?lastyblocksize:yblocksize),
false, 2, DAQmx_Val_GroupByScanNumber);
113 DBOUT(L
"OutputsDAQmxLineClock::Write written " << written << L
" samples");
125 task.
WriteAnalogI16(std::make_shared<std::vector<int16_t>>(2,0)->data(), 1,
true);
133 task.
WriteAnalogI16(std::make_shared<std::vector<int16_t>>(2,0)->data(), 1,
true);
ScopeString commontrigger
The trigger channel which is the internal common master trigger for all devices.
ScopeString pixel_referenceclocksource
source terminal of the reference clock for pixel sampling clock
void SetRegeneration(const bool &_regenerate)
Sets the mode of sample regeneration.
The master parameters class.
void ConfigureReferenceClock(const std::wstring &_src, const float64 &_rate)
Configures the reference clock for the task.
int32_t WaitUntilDone(const float64 &_waittime)
Waits until the task is done.
DAQmx::CDAQmxAnalogOutTask yzout_task
Task for y-scanner/fast z clocked by the line clock from the FPGA.
std::array< std::unique_ptr< Area >, SCOPE_NAREAS > areas
holds AreaParameters for all areas.
ScopeValue< DaqTiming > line_timing
where to get the line sampling clock from? Onboard, from external reference clock, or from external source
std::wstring ClockString(const scope::DaqTimingHelper::Mode &_timing, const std::wstring &_externalclocksource)
Generates a string for the sample clock from daq_timing.
std::atomic< bool > writeabort
Signal for aborting a write operation (since write is performed in several blocks, abort can happen in between)
ScopeString triggerchannel
channel name for trigger input
uInt32 ConfigureBuffer(const uInt32 &_sampsperchannel)
Configure the daqmx output buffer on the PC.
DAQmx::CDAQmxAnalogOutTask xpout_task
Task for x-scanner/Pockels clocked by the pixel clock from the FPGA.
Timeseries timeseries
the TimeseriesParameters
int32 WriteAnalogI16(const int16 *_data, int32 _sampsperchan, bool _autostart=false, int32 _timeout=2, bool32 _layout=DAQmx_Val_GroupByChannel)
Writes several samples to the buffer of an analog output task.
void Start() override
Start task.
void SetWriteOffset(int32 posreltofirst)
Sets the write offset relative to the first buffer position.
void SetDataTransferCondition(const std::wstring &_channel, const int32_t &_cond)
Configures the condition for data transfer to the device.
This is the include file for standard system include files, or project specific include files that ar...
ScopeValue< DaqMode > requested_mode
requested acquisition mode (see DaqModeHelper)
void Start(void)
Starts the task.
ScopeValue< DaqTiming > pixel_timing
where to get the pixel sampling clock from? Onboard, from external reference clock, or from external source
int32_t YTotalLines
Length of a column in samples.
ScopeNumber< bool > triggered
the current/first repeat is triggered on triggerchannel
ScopeNumber< double > pixel_referenceclockrate
rate in Hertz of the reference clock for pixel clock.
#define DBOUT(s)
A debug output to the debug console.
int32_t XTotalPixels
Length of a line in samples.
void ScopeExceptionHandler(const std::string &_origin, const bool &_log, const bool &_showmessagebox, const bool &_trace, const bool &_rethrow)
Handles all exceptions and does nice logging.
ScopeString line_referenceclocksource
source terminal of the reference clock for line sampling clock
void CreateAOVoltageChannel(const std::wstring &_devices, const std::wstring &_channelname=L"", float64 _minval=-10.0, float64 _maxval=10.0, int32 _units=DAQmx_Val_Volts, const std::wstring &_customscalename=L"")
Creates an analog output channel Allowed values for terminal configuration (from NiDAQmx.h): Values for DAQmx_PhysicalChan_AI_TermCfgs and DAQmx_PhysicalChan_AO_TermCfgs Value set TerminalConfigurationBits .
Wraps a DAQmx Analog Output task.
void Clear(void)
Clear the task.
ZeroOutputsDAQmxLineClock(const parameters::OutputsDAQmxLineClock &_params)
Create a simple tasks for writing a scalar zero to all channels.
void CreateTask(const std::wstring &_name=L"")
void ConfigureSampleTiming(const std::wstring &_src, const float64 &_rate, const int32 &_samplesperchan, const int32 &_samplingtype=DAQmx_Val_ContSamps, const int32 &_actedge=DAQmx_Val_Rising)
Configures a sample timing for the task.
const uint32_t area
which area this one is for
int32_t Write(const std::vector< int16_t > &_xyzp, const uint32_t &_blocks) override
Writes values for one frame of X-Y-fastZ and pockels data to the device buffer.
ScopeNumber< double > line_referenceclockrate
rate in Hertz of the reference clock for line clock.
ScopeNumber< double > range
Output range of the DAC to use for all outputs.
ScopeString yzout
Analog output channel for y-scanner and fast z device (clocked by line clock)
ScopeString pixel_externalclocksource
source terminal of an external clock for x and p pixel clock
OutputsDAQmxLineClock(const uint32_t &_area, const parameters::OutputsDAQmxLineClock &_outputparams, const parameters::Scope &_params)
Creates the tasks and clock tasks.
void Stop() override
Stops task.
ScopeString line_externalclocksource
source terminal of an external clock for y and z line clock
Parameters for x/y-scanner/fast z/Pockels signal generation with NI-DAQmx where xp are driven by a pi...
ScopeString xpout
Analog output channel for x-scanner and Pockels cell (clocked by pixel clock)
void ConfigureDigStartTrigger(const std::wstring &_src, const int32 &_trigedge=DAQmx_Val_Rising)
Configures the start trigger.
void Stop(void)
Stops the task.
Wraps hardware connection for signal output to scanners, fast z control, and pockels cell...