public RS232GroupChannelSelection() { InitializeComponent(); groupChannelData = new RS232GroupChannelData(); logicalChannel = new LogicalChannel(); this.layout(); foreach (RS232GroupChannelData.RS232DataType type in RS232GroupChannelData.allDataTypes) { this.dataTypeSelector.Items.Add(type); } }
public RS232GroupChannelSelection(LogicalChannel logicalChannel, RS232GroupChannelData groupChannelData) : this() { this.groupChannelData = groupChannelData; this.logicalChannel = logicalChannel; this.toolTip1.SetToolTip(channelNameLabel, logicalChannel.Description); this.layout(); this.dataTypeSelector.Items.Clear(); foreach (RS232GroupChannelData.RS232DataType type in RS232GroupChannelData.allDataTypes) { this.dataTypeSelector.Items.Add(type); } //this.dataTypeSelector.Items.AddRange(GPIBGroupChannelData.GpibChannelDataType.allTypes); this.dataTypeSelector.SelectedItem = groupChannelData.DataType; this.rawStringTextBox.Text = groupChannelData.RawString; }
private void layoutGraphCollection() { if (WordGenerator.MainClientForm.instance != null) { WordGenerator.MainClientForm.instance.cursorWait(); } try { List <Waveform> waveformsToDisplay = new List <Waveform>(); List <string> channelNamesToDisplay = new List <string>(); // figure out what to display in the waveform graph if (rs232Group != null) { List <int> usedChannelIDs = rs232Group.getChannelIDs(); for (int id = 0; id < usedChannelIDs.Count; id++) { RS232GroupChannelData channelData = rs232Group.ChannelDatas[id]; if (channelData.Enabled) { // if there are graph-based rs232 data types in future, add their waveform display handlers here } } } waveformGraphCollection1.deactivateAllGraphs(); waveformGraphCollection1.setWaveforms(waveformsToDisplay); waveformGraphCollection1.setChannelNames(channelNamesToDisplay); waveformGraphCollection1.setWaveformEditor(waveformEditor1); } finally { if (WordGenerator.MainClientForm.instance != null) { WordGenerator.MainClientForm.instance.cursorWaitRelease(); } } }
public bool generateBuffer(SequenceData sequence, DeviceSettings deviceSettings, HardwareChannel hc, int logicalChannelID) { lock (commandBuffer) { commandBuffer.Clear(); this.logicalChannelID = logicalChannelID; if (deviceSettings.StartTriggerType != DeviceSettings.TriggerType.SoftwareTrigger) { throw new Exception("RS232 devices must have a software start trigger."); } // List<TimeStep> enabledSteps = sequence.enabledTimeSteps(); int currentStepIndex = -1; //measured in ticks. 1 tick = 100 ns. long currentTime = 0; long postRetriggerTime = 100; // corresponds to 10us. // A workaround to issue when using software timed groups in // fpga-retriggered words // the workaround: delay the software timed group by an immesurable amount // if it is started in a retriggered word // This functionality is sort of somewhat duplicated in sequencedata.generatebuffers. It would be good // to come up with a more coherent framework to do these sorts of operations. while (true) { currentStepIndex++; if (currentStepIndex >= sequence.TimeSteps.Count) { break; } TimeStep currentStep = sequence.TimeSteps[currentStepIndex]; if (!currentStep.StepEnabled) { continue; } long postTime = 0; if (currentStep.RetriggerOptions.WaitForRetrigger) { postTime = postRetriggerTime; } if (currentStep.rs232Group == null || !currentStep.rs232Group.channelEnabled(logicalChannelID)) { currentTime += seconds_to_ticks(currentStep.StepDuration.getBaseValue()); continue; } // determine the index of the next step in which this channel has an action int nextEnabledStepIndex = sequence.findNextRS232ChannelEnabledTimestep(currentStepIndex, logicalChannelID); long groupDuration = seconds_to_ticks(sequence.timeBetweenSteps(currentStepIndex, nextEnabledStepIndex)); // now take action: RS232GroupChannelData channelData = currentStep.rs232Group.getChannelData(logicalChannelID); if (channelData.DataType == RS232GroupChannelData.RS232DataType.Raw) { // Raw string commands just get added string stringWithCorrectNewlines = AddNewlineCharacters(channelData.RawString); commandBuffer.Add(new RS232Command(stringWithCorrectNewlines, currentTime + postTime)); } else if (channelData.DataType == RS232GroupChannelData.RS232DataType.Parameter) { if (channelData.StringParameterStrings != null) { foreach (StringParameterString srs in channelData.StringParameterStrings) { commandBuffer.Add(new RS232Command( AddNewlineCharacters(srs.ToString()), currentTime + postTime)); } } } currentTime += seconds_to_ticks(currentStep.StepDuration.getBaseValue()); } } return(true); }