Hello everyone,
I am currently designing a calibration system for some equipment and want to be able to create a simple interface (initially) that will read real time samples from the Agilent 34970A (Data Acquisition Unit) and display them in a text box continuously until a separate button is pressed, which would interrupt the process. Here is some of my code:
When I press the StartSampleButton, it takes a single sample from the 34970A and places the result in the RealTimeSample box (no problems here).
The problem comes in when I want to do multiple samples. I've been trying something along the lines of:
I was hoping it would continuously sample the data and place it in the box but it takes the samples a second apart each time but never places it in the box. Does anyone have any ideas why that might be? (Might be a hardware issue).
The big problem I'm having though is that, assuming I get the data to sample continuously, I want to make it so clicking the StartSample button should cause the program to read data continuously into the RealTimeSample box until the TakeSample Button is pressed, which stops the sampling and moves the data into the TakenSample box.
This is what I have so far:
Can anyone help me figure out how to use the TakeSample button as an interrupt to exit the sampling loop? Thanks!
I am currently designing a calibration system for some equipment and want to be able to create a simple interface (initially) that will read real time samples from the Agilent 34970A (Data Acquisition Unit) and display them in a text box continuously until a separate button is pressed, which would interrupt the process. Here is some of my code:
VB.NET:
Private Sub StartSampleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartSampleButton.Click
ioDmm.WriteString("MEAS:VOLT:DC? AUTO,MAX,(@101)")
RealTimeSample.Text = ioDmm.ReadNumber
End Sub
When I press the StartSampleButton, it takes a single sample from the 34970A and places the result in the RealTimeSample box (no problems here).
The problem comes in when I want to do multiple samples. I've been trying something along the lines of:
VB.NET:
Private Sub StartSampleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartSampleButton.Click
While 1
ioDmm.WriteString("MEAS:VOLT:DC? AUTO,MAX, (@101)")
RealTimeSample.Text = ioDmm.ReadNumber
System.Threading.Thread.Sleep(1000)
End While
End Sub
I was hoping it would continuously sample the data and place it in the box but it takes the samples a second apart each time but never places it in the box. Does anyone have any ideas why that might be? (Might be a hardware issue).
The big problem I'm having though is that, assuming I get the data to sample continuously, I want to make it so clicking the StartSample button should cause the program to read data continuously into the RealTimeSample box until the TakeSample Button is pressed, which stops the sampling and moves the data into the TakenSample box.
This is what I have so far:
VB.NET:
Dim Sampled As Integer = 0
Private Sub StartSampleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StartSampleButton.Click
While 1
If Sampled = 0 Then
ioDmm.WriteString("MEAS:VOLT:DC? AUTO,MAX, (@101)")
RealTimeSample.Text = ioDmm.ReadNumber
System.Threading.Thread.Sleep(1000)
ElseIf Sampled = 1 Then
Exit While
End If
End While
End Sub
Private Sub TakeSampleButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TakeSampleButton.Click
TakenSample.Text = RealTimeSample.Text
Sampled = 1
End Sub
Can anyone help me figure out how to use the TakeSample button as an interrupt to exit the sampling loop? Thanks!