/** * Returns an array of data packets to be sent to the board * in order to execute the waveform * * "append" is a secondary waveform whose append.data may be added to the current waveform; * this is useful if this.data is intended to be output onto DAC A, * and append.data is intended to be output onto DAC B (or vice versa) * * this.data and append.data must have the same length (according to V5, Data.RunSRAM() * calls upon a block of SRAM, each entry of which contains both information for DAC A and * DAC B output - thus, mismatching waveform lengths will result in errors in output) * * In the case that this.data and append.data has differing waveform lengths, * this routine has chosen to copy as many bytes as possible from append.data to this.data; * we will employ zero-padding if append.data is shorter than this.data, and * we will trim this.append in the case that the array is longer than this.data * * Example: * * WaveForm output_a = new SineWave(length : 40); * WaveForm output_b = new StepWave(new double[] { 0.1, 0.2 }, new int[] { 10, 20 }); * Data.Data[] packets = output_a.Prep(shift : Board.DAC.dac_a).Run(append : output_b.Prep(shift : Board.DAC.dac_b)) * * Here, we are outputting a sine wave on DAC A, and a step wave on DAC B; * note that output_a has an SRAM length of 40 words, whereas * output_b has an SRAM length of 30 words - here, * we are to extend output_b by ten 0x00000000 words, and copy the result into output_a */ public virtual Data.Data[] Run(bool continuous = true, WaveForm append = null, byte readback = 0x00) { if ((this.data == null) || (append != null && append.data == null)) { // indicates Prep() has not been invoked yet // TODO : need to throw an exception here } if (append != null) { for (int i = 0; i < Math.Min(this.data.Length, append.data.Length); i++) { this.data[i] += append.data[i]; } } // create the packet which actually will execute the waveform List <Data.Data> packets = new List <Data.Data>(Data.SRAMData.LoadSRAMData(this.data)); Data.Data packet = new Data.RunSRAM(0, this.data.Length / 4, continuous, 0, readback: readback); packets.Add(packet); return(packets.ToArray()); }
public override Data.Data[] Run(bool continuous = true, WaveForm append = null, byte readback = 0x00) { return(base.Run(continuous: false)); }