/// <summary> /// Retruns true if no error occured while sending the settings /// </summary> public override bool Setting_for_Sensitivity(Sensitvity_Measurement mySensitivity) { //1. Error Counter zurücksetzen************************************************************************************************************** uint error_Sum = 0; //2. Mess-Einstellungen anpassen************************************************************************************************************* error_Sum += Activate_Chanel_0(); error_Sum += Diff_Channel_0to1(); error_Sum += Input_1MOhm_Channel_0(); error_Sum += Input_1MOhm_Channel_1(); error_Sum += Set_Range(); error_Sum += Set_Frequency(); //Eventuell Freuenz ändern error_Sum += Setting_for_Single_Measurment(); //3. Parameter für Messlänge senden********************************************************************************************************** error_Sum += Set_Sample_Count(mySensitivity.Nr_of_samples); error_Sum += Set_Samples_PostTrigger(mySensitivity.Nr_of_samples); //4. Feld für die Messdaten generiern******************************************************************************************************** mySensitivity.RawData = new short[mySensitivity.Nr_of_samples]; //Feld in der Länger definieren H_BufferHandle = GCHandle.Alloc(mySensitivity.RawData, GCHandleType.Pinned); //Speicherplatz sperren Daten_Pointer = H_BufferHandle.AddrOfPinnedObject(); //Pointer für gesperten Speicherplatz suchen //5. Fehlerauswertung******************************************************************************************************** if (error_Sum != 0) { MessageBox.Show("An error occured while sending the Settings!\n Look on LOG and try again.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } else { return(true); } }
public bool TTA_wait_for_Trigger() { //Mögliche Errors mitzählen uint error_Sum = 0; error_Sum += WaitTime_for_Trigger_inf(); error_Sum += Adopt_Settings(); error_Sum += Start_Card(); error_Sum += Wait_to_fill_PreTrigger(); error_Sum += Enable_Trigger(); error_Sum += Force_Trigger_after_time((long)Samples * 1000 / Frequency); //Auf Errors checken if (error_Sum != 0) { MessageBox.Show("An Error occured while measurment!\n Error Code: ." + error_Sum.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); //Speicher lösen H_BufferHandle.Free(); return(false); } else { return(true); } }
public bool TTA_reserve_Storage(short[,] array) { //Speicherplatz sperren H_BufferHandle = GCHandle.Alloc(array, GCHandleType.Pinned); //Pointer für gesperten Speicherplatz suchen Daten_Pointer = H_BufferHandle.AddrOfPinnedObject(); return(true); }
public bool TTA_Collect_Data(short[,] data_out, int cycle) { uint error_Sum = 0; //Wurde ein Trigger Event gefunden (wenn nich Rückgabewert ist 263) if (Did_Trigger_Event_occured() == 263) { //Fehlermeldung //SetAsyncText(Spectrum_answer, "Kein Trigger gefunden"); error_Sum += 263; error_Sum += Force_Trigger(); } //4. Daten abholen********************************************************************************************** //WArten bis alle Daten vorhanden sind (unendlich lang möglich) error_Sum += WaitTime_for_Trigger_inf(); error_Sum += Wait_for_all_samples(); //Datentransfer einstellen (Datapointer enspricht der Stelle des ersten Samples im Array) //Bei weiteren Zyklen muss dieser Pointer geändert werden //DataPointer is [0,0] //anzahl_samples entspricht der Länge einer Zeile //2 ist notwendig für short (2byte) //i ist die aktuelle Zeile (Zyklus) IntPtr aktuellerPointer = new IntPtr(Daten_Pointer.ToInt64() + 2 * cycle * Samples); error_Sum += Send_Pointer_of_Array(aktuellerPointer, Samples); error_Sum += Get_Data(); //Auf Errors checken if (error_Sum != 0) { MessageBox.Show("An Error occured while measurment!\n Error Code: ." + error_Sum.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); //Speicher lösen H_BufferHandle.Free(); return(false); } else { return(true); } }
/// <summary> /// Retruns true if no error occured while sending the settings /// </summary> public override bool Measure_Sensitivity_DEMO(Sensitvity_Measurement mySensitivity) { //Mögliche Errors mitzählen uint error_Sum = 0; //Speicher definieren & Spreren mySensitivity.RawData = new short[mySensitivity.Nr_of_samples]; H_BufferHandle = GCHandle.Alloc(mySensitivity.RawData, GCHandleType.Pinned); Daten_Pointer = H_BufferHandle.AddrOfPinnedObject(); //Messung starten error_Sum += WaitTime_for_Trigger_inf(); error_Sum += Adopt_Settings(); error_Sum += Start_Card(); error_Sum += Force_Trigger(); //Daten abholen error_Sum += WaitTime_for_Trigger_inf(); error_Sum += Wait_for_all_samples(); //Datentransfer einstellen (Datapointer enspricht der Stelle des ersten Samples im Array) IntPtr aktuellerPointer = new IntPtr(Daten_Pointer.ToInt64()); error_Sum += Send_Pointer_of_Array(aktuellerPointer, mySensitivity.Nr_of_samples); error_Sum += Get_Data(); //Auf Errors checken if (error_Sum != 0) { MessageBox.Show("An Error occured while measurment!\n Look at LOG: .", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } else { return(true); } }
public bool TTA_free_Storage(short[,] array) { H_BufferHandle.Free(); return(true); }