Hi All.
I am trying to get a serial connection running, and as far as I can tell I have it properly done. I can see my serial device, and this is confirmed as it disappears when I remove the connection, and re-appears when I attach it.
With a button I have created I went to send data in my textfield to the unit, and when I do so I see the indicator flash, however I never get any data in my textArea.
Here is my button code:
SerialConnection1.Connect
SerialConnection1.Parity = SerialConnection.Parities.Odd
SerialConnection1.Baud = SerialConnection.Baud9600
SerialConnection1.Write(TextField1.text)
and here is my data received code within my serialConnection1
Var data As String
data = Me.LookAhead
If data.IndexOf(EndOfLine.Windows) > -1 Then
TextArea1.Value = TextArea1.Value + Me.ReadAll
End If
Any ideas where I can look for why?
Regards
are you sure your device sends an endofline.windows ?
what happens if you remove the line
If data.IndexOf(EndOfLine.Windows) > -1 Then
may be better… only :
TextArea1.Value = TextArea1.Value + Me.ReadAll
also take care of the encodings of the incoming string ?
Hi Jean-Yves
Yeah, tried that. I can see the data going to my usb modem, but I get nothing back!
I’ve looked through examples but don’t see any examples for serialConnections. Does anyone have an example they would like to share?
Regards
do you get something back from the device if you use a serial terminal app ?
Hi Jean-Yves.
When I connect with the Mac Terminal Program, I get a response to various AT commands.
But interestingly, when I physically connected the USB modem to my Mac, I now get an error when I try to connect. “Access denied”
Here is the code that worked with another serial device
Sub Action()
If Me.Caption = "Disconnect" Then // Disconnect from the serial device
SerialConnection1.Close
Me.Caption = "Connect"
DevicesPopupMenu.Enabled = True
DeviceListUpdater.RunMode = Timer.RunModes.Multiple 'turn it on
Else // Connect to the serial device
// Set the serial device to the index of the one chosen in the popup menu
SerialConnection1.Device = SerialDevice.At(DevicesPopupMenu.SelectedRowIndex)
Try
SerialConnection1.Connect --> this is where I get the access denied Error 100
DevicesPopupMenu.Enabled = False
DeviceListUpdater.RunMode = Timer.RunModes.Off
Me.Caption = "Disconnect"
Catch error As IOException
Beep
MessageBox("The selected serial device could not be opened.")
End Try
End If
End Sub
Update: I loaded the drivers (newest ones) for the usr Robotics 56k Modem and now I can connect.
I still don’t get a response displayed when I send an ATH command, even though I get a response from the modem with a terminal command.
Regards