Synchronizing Modular Instruments with Homogenous Triggers
- Updated2023-02-17
- 2 minute(s) read
Synchronizing Modular Instruments with Homogenous Triggers
You can synchronize modular instruments with homogenous triggers using TClock:
- Open several modular instrument sessions and configure any required properties on the individual instruments.
- Create a TClock object.
- Access the DevicesToSynchronize property on the TClock object. The TClock object exposes the collection present in TClock.
- Add the modular instrument objects through the Add method exposed on the TClockSynchronizableDevicesCollection.
- Call ConfigureForHomogeneousTriggers exposed on the TClock object. This call will configure the modular instrument devices present in the collection held by the TClock object for homogeneous triggers.
- Call the Synchronize method exposed on the TClock object. This call will align the sample clocks and triggers of the modular instrument devices present in the DevicesToSynchronize collection.
- Call the Initiate method exposed on the TClock object. This call will Initiate the synchronized acquisition/generation on the modular instrument devices present in the DevicesToSynchronize collection.
Visual Basic .NET Using scopeSession1 = New NIScope(resourceName1, False, False) Using scopeSession2 = New NIScope(resourceName2, False, False) scopeSession1.Measurement.AutoSetup() scopeSession2.Measurement.AutoSetup() Dim tClock As New TClock() tClock.DevicesToSynchronize.Add(scopeSession1) tClockSession.ConfigureForHomogeneousTriggers() tClockSession.Synchronize() tClockSession.Initiate() Dim recordLength1 As Long = scopeSession1.Acquisition.RecordLength Dim recordLength2 As Long = scopeSession2.Acquisition.RecordLength scope1Waveform = scopeSession1.Channels("0").Measurement.FetchDouble(New PrecisionTimeSpan(5.0), recordLength1, scope1Waveform) ' Consume data fetched in scope1Waveform and scope2Waveform. scope2Waveform = scopeSession2.Channels("0").Measurement.FetchDouble(New PrecisionTimeSpan(5.0), recordLength2, scope2Waveform) End Using End Using ' scopeSession1 and scopeSession2 will be disposed after this line of code.
Visual C# using (scopeSession1 = new NIScope(resourceName1, false, false)) using (scopeSession2 = new NIScope(resourceName2, false, false)) { scopeSession1.Measurement.AutoSetup(); scopeSession2.Measurement.AutoSetup(); TClock tClock = new TClock(); tClock.DevicesToSynchronize.Add(scopeSession1); tClockSession.ConfigureForHomogeneousTriggers(); tClockSession.Synchronize(); tClockSession.Initiate(); long recordLength1 = scopeSession1.Acquisition.RecordLength; long recordLength2 = scopeSession2.Acquisition.RecordLength; scope1Waveform = scopeSession1.Channels["0"].Measurement.FetchDouble(new PrecisionTimeSpan(5.0), recordLength1, scope1Waveform); scope2Waveform = scopeSession2.Channels["0"].Measurement.FetchDouble(new PrecisionTimeSpan(5.0), recordLength2, scope2Waveform); // Consume data fetched in scope1Waveform and scope2Waveform. } // scopeSession1 and scopeSession2 will be disposed after this line of code.