To use D0's state as the storage control, you can use Digital0 as
trigger channel and set the trigger mode to WhenAboveLevel:
Dim buffer(1000) As Integer
Dim diodir As Integer
Dim currentrow As Integer
Private Sub StartButton_Click()
'Clear the worksheet
For i = 0 To DQChart1.Xmax
ActiveSheet.Cells(i + 1, 1) = ""
Next i
currentrow = 1
UltimaSerial.Device = Val(List1.Text) 'Select the device
UltimaSerial.CommPort = Val(Combo1.Text) 'COM port
UltimaSerial.PChannel(0) = Ch01_SE
UltimaSerial.PChannel(1) = DIG_Chn 'without it, DIN is not available
UltimaSerial.AcquisitionMode = WhenAboveLevel
UltimaSerial.TriggerChannel = Digital0
UltimaSerial.ChannelCount = 2 'enable only one analog channel
UltimaSerial.SampleRate = Val(TextBox1.Text)
UltimaSerial.EventLevel = 2 'Chart it when we have 2 or more points.
UltimaSerial.Start
Label4.Caption = "Serial Number: " + UltimaSerial.SerialNumber
End Sub
Private Sub StopButton_Click()
UltimaSerial.Stop
End Sub
Private Sub UltimaSerial_DriverError(ByVal ErrorCode As Integer)
Label4.Caption = UltimaSerial.MapErrorMessage(ErrorCode)
End Sub
Private Sub UltimaSerial_NewData(ByVal Count As Integer)
'This will be called if we use NewData event to acquire data
V = UltimaSerial.GetData() 'Get data
DQChart1.Chart (V) 'Chart all channels
If IsEmpty(V) Then Exit Sub
For i = 0 To UBound(V, 2)
ActiveSheet.Cells(i + currentrow, 1) = Format$((V(0, i)) / 3276.8,
"0.00") 'extract the first channel
currentrow = currentrow + 1
If currentrow = 30 Then currentrow = 1
Next i
Label18.Caption = UltimaSerial.DigitalInput(Dig0)
End Sub
Private Sub UserForm_Activate()
List1.AddItem "150RS" 'Devices
List1.AddItem "151RS"
List1.AddItem "194"
List1.AddItem "195B"
List1.AddItem "190"
List1.AddItem "148U"
List1.AddItem "158U"
List1.AddItem "710U"
List1.AddItem "718U"
List1.AddItem "154RS"
Combo1.AddItem "1 - COM1" 'COM port
Combo1.AddItem "2 - COM2"
Combo1.AddItem "USB"
End Sub
--- In ultimaserial_group@yahoogroups.com, "throrope" <throrope@...>
wrote:
>
> I'm using a 148U to capture descrete readings from a hand held probe.
> The analog single provides a running graph of the output which will
> let me see when the signal is stable. Since I'm about 12 feet from
> the computer, "Aquire Data" button in the user form won't do. I'd
> like to use the status of D0 per a momentary switch to accomplish
> capture. I modified the code to do so, but a buffer or something
> fills and locks up excel.
>
> I tried to create a goto loop with the same result. And, for some
> reason the command button had to be actuated for the DI to take.
>
> I tried calling the aquire data sub from the start button, with more
> errors.
>
> Any suggestions?
>