//create the counter, and set up the buffers based on the hardware configuration internal void Setup() { ConfigureCounter(); //masterLoad = buffLoadTask.COChannels[0].PulseTerminal; //assign tasks to buffers if (Properties.Settings.Default.UseAODO) { //ConfigureAODO(true, masterTask); auxOut.immortal = true; digitalOut.immortal = true; //DigitalOut.Setup(buffLoadTask, debugger, masterTask); auxOut.grabPartner(digitalOut); digitalOut.grabPartner(auxOut); auxOut.Setup(buffLoadTask, debugger, masterTask); auxOut.Start(); //DigitalOut.Start(); } if (Properties.Settings.Default.UseStimulator) { //ConfigureStim(masterTask); stimOut.immortal = true; stimOut.Setup(buffLoadTask, debugger, masterTask); stimOut.Start(); } }
/// <summary> /// Neurorighter's stimulus/generic output server. Used in open-loop and closed-loop experiments where just-in-time buffering of output signals is required. /// </summary> /// <param name="INNERBUFFSIZE"> The size of one half of the double output buffer in samples</param> /// <param name="STIM_SAMPLING_FREQ">The DAC sampling frequency in Hz for all forms of output</param> /// <param name="masterTask">The NI Task to which all of the output clocks are synchronized to</param> /// <param name="debugger"> NR's real-time debugger</param> /// <param name="robust">used to determine if the StimServer will be recover from failures</param> internal StimSrv(int INNERBUFFSIZE, int STIM_SAMPLING_FREQ, Task masterTask, Logger debugger, bool robust) { this.masterTask = masterTask; this.INNERBUFFSIZE = INNERBUFFSIZE; this.STIM_SAMPLING_FREQ = STIM_SAMPLING_FREQ; int sampblanking = 2; int queueThreshold = -1;//no queue thresholds for closed loop //create buffers auxOut = new AuxBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, queueThreshold, robust); digitalOut = new DigitalBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, queueThreshold, robust); auxOut.grabPartner(digitalOut); digitalOut.grabPartner(auxOut); stimOut = new StimBuffer(INNERBUFFSIZE, STIM_SAMPLING_FREQ, sampblanking, queueThreshold, robust); this.debugger = debugger; this.sampleFrequencyHz = Convert.ToDouble(STIM_SAMPLING_FREQ); this.dacPollingPeriodSec = Properties.Settings.Default.DACPollingPeriodSec; this.dacPollingPeriodSamples = Convert.ToInt32(dacPollingPeriodSec * STIM_SAMPLING_FREQ); }